Created
April 17, 2016 22:12
-
-
Save sergueif/cf9b6de5493aaaeef3cf880c8f788be4 to your computer and use it in GitHub Desktop.
Active Record to Value (take 2)
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 Account < ActiveRecord::Base | |
#id integer | |
#first_name string | |
#last_name string | |
class Value | |
include Virtus.value_object | |
attribute :id, Integer | |
attribute :first_name, String | |
attribute :last_name, String | |
end | |
def as_value | |
Value.new(attributes) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment