Last active
December 17, 2015 16:29
-
-
Save jwaldrip/5639489 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 FeedItem < ActiveRecord::Base | |
# hstore is data | |
def self.field(name) | |
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 | |
def #{name}=(val) | |
self.data[:#{name}] = val | |
end | |
def #{name} | |
self.data[:#{name}] | |
end | |
RUBY | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment