Created
December 2, 2015 00:39
-
-
Save tonyc/ec6ae3425383b48fe28b to your computer and use it in GitHub Desktop.
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 User | |
has_one :plan | |
def has_feature?(name) | |
plan.has_feature? name | |
end | |
end | |
class Plan | |
has_many :line_items | |
def has_feature?(name) | |
line_items.find { |l| l.name.to_sym == name.to_sym } | |
end | |
end | |
class LineItem | |
# name:symbol | |
# cost_cents:integer | |
# whatever else | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment