Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recovered a ton of lost commits in one fell swoop. upgraded to Rails …
…2.3 compatiblity.
- Loading branch information
Showing
23 changed files
with
256 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,37 @@ | ||
# Filters added to this controller apply to all controllers in the application. | ||
# Likewise, all the methods added will be available for all controllers. | ||
|
||
class ApplicationController < ActionController::Base | ||
class Application < ActionController::Base | ||
include AuthenticatedSystem | ||
|
||
protect_from_forgery | ||
|
||
helper :all # include all helpers, all the time | ||
|
||
filter_parameter_logging :password, :password_confirmation | ||
|
||
protect_from_forgery :secret => 'ad5fcf9cf9a6c79ef7b70f6ff02c6fca8e6692d9cd48306a21f27be3e36658f49234fe' | ||
|
||
skip_before_filter :verify_authenticity_token # Page caching screws up forgery protection stuff | ||
|
||
POST_TYPES = %w(articles links pictures quotes snippets tweets gists) | ||
POST_TYPE_PATTERN = /\/(#{POST_TYPES.join('|')})(\.rss)?\/?/i | ||
|
||
def expire_path(file) | ||
file = RAILS_ROOT + '/public' + file | ||
file = File.join(Rails.root.to_str, 'public', file) | ||
FileUtils.rm_rf(file) if File.exists?(file) | ||
logger.info("Expired cache: #{file}") | ||
end | ||
|
||
protected | ||
def post_repo | ||
|
||
# two replaces, but it's better than duped code. | ||
@post_type = params[:posts_type] || request.path.gsub(/^\/admin/, '/').gsub(POST_TYPE_PATTERN, '\1') | ||
|
||
# for some reason '/' this gets classified as '::', which is an Object. Adding a check for that. | ||
throw NameError if @post_type.eql?('/') | ||
|
||
return @post_type.classify.constantize | ||
rescue => e | ||
logger.info(e) | ||
@post_type = 'posts' | ||
return @post_type.classify.constantize | ||
end | ||
|
||
def not_found | ||
cookies[:error] = "Sorry but that post could not be found." | ||
redirect_to root_path and return | ||
def post_repo | ||
begin | ||
@post_type = post_type.to_s.tableize | ||
@post_type.classify.constantize | ||
rescue => e | ||
logger.info(e) | ||
@post_type = :post | ||
retry | ||
end | ||
end | ||
|
||
def not_found | ||
cookies[:error] = "Sorry but that post could not be found." | ||
redirect_to root_path and return | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,6 @@ def name | |
end | ||
|
||
def to_param | ||
from_feed? ? id : permalink | ||
from_feed? ? id.to_s : permalink | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ def link_text | |
end | ||
|
||
def to_param | ||
attributes['id'] | ||
attributes['id'].to_s | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.