Last active
October 3, 2015 02:28
-
-
Save chsh/2372574 to your computer and use it in GitHub Desktop.
It's my reminder. I always forget this. ;-)
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 NonActiveRecordModel | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
def persisted?; false end | |
def initialize(hash = {}) | |
hash.each do |key, value| | |
m = "#{key}=" | |
self.send(m, value) if self.respond_to?(m) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment