Skip to content

Instantly share code, notes, and snippets.

@sergueif
Created April 17, 2016 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergueif/cf9b6de5493aaaeef3cf880c8f788be4 to your computer and use it in GitHub Desktop.
Save sergueif/cf9b6de5493aaaeef3cf880c8f788be4 to your computer and use it in GitHub Desktop.
Active Record to Value (take 2)
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