Created
November 17, 2012 04:31
-
-
Save farmdawgnation/4093289 to your computer and use it in GitHub Desktop.
Examples for Blog Post on 11/16
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
class ParentThing < ActiveRecord::Base | |
include SecureThingBehavior | |
# Make the storage location of all our secure things accessible | |
# along with whatever else you need. | |
attr_accessible :secure | |
end | |
class ThingA < ParentThing | |
attr_secure :meeting_location, :meeting_passcode | |
end | |
class ThingB < ParentThing | |
attr_secure :meeting_time | |
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
stuff = ThingA.new | |
stuff.meeting_location = "London" # stored encrypted | |
stuff.meeting_location # => "London" |
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
attrs = { :meeting_location => "London", :meeting_time => "5PM" } | |
stuff = ThingA.new attrs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment