Skip to content

Instantly share code, notes, and snippets.

@albus522
Created July 3, 2012 18:55
Show Gist options
  • Save albus522/3041932 to your computer and use it in GitHub Desktop.
Save albus522/3041932 to your computer and use it in GitHub Desktop.
class Message
include ActiveModel::Conversion
include ActiveModel::Validations
extend ActiveModel::Naming
def initialize(attributes = {})
attributes.each do |key, value|
eval "class << self; attr_accessor :#{key}; end"
send("#{key}=", value)
end
end
def persisted?
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment