This file contains hidden or 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
class PrivacyFilter | |
class << self | |
def filter(controller) | |
@controller = controller | |
first_article? or administrator? or user? | |
end | |
def first_article? | |
@controller.params[:id] == 1 |
This file contains hidden or 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
# Replace Inheritance with Delegation | |
# http://refactoring.com/catalog/replaceInheritanceWithDelegation.html | |
# class Roster < Array | |
# attr_accessor :title | |
# def to_s | |
# out = "#{title}\n" | |
# each do |item| | |
# out += "#{item}\n" |
NewerOlder