Skip to content

Instantly share code, notes, and snippets.

@farmdawgnation
Created November 17, 2012 04:31
Show Gist options
  • Save farmdawgnation/4093289 to your computer and use it in GitHub Desktop.
Save farmdawgnation/4093289 to your computer and use it in GitHub Desktop.
Examples for Blog Post on 11/16
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
stuff = ThingA.new
stuff.meeting_location = "London" # stored encrypted
stuff.meeting_location # => "London"
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