Skip to content

Instantly share code, notes, and snippets.

@adz
Created October 6, 2014 14:06
Show Gist options
  • Save adz/6b7e21689c7540a46567 to your computer and use it in GitHub Desktop.
Save adz/6b7e21689c7540a46567 to your computer and use it in GitHub Desktop.
Simple null object
class Client < ActiveRecord::Base
belongs_to :pricing_level
end
class PricingLevel
def self.find_default
#...
end
end
class Guest
def name
'Guest'
end
def pricing_level
PricingLevel.find_default
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment