Skip to content

Conversation

@artemeff
Copy link

@artemeff artemeff commented Aug 4, 2015

#attributes= method behaves like set these attributes for this object in my mind, but works like update provided attributes in object, and I'm feel wrong when using it in this way.

require 'virtus'

class User
  include Virtus.model

  attribute :name
  attribute :age
end

user = User.new(name: 'John Doe', age: 21)
# => #<User:0x007fe7b38d71e0 @name="John Doe", @age=21>

user.attributes = { name: 'John Snow' }
# => #<User:0x007fe7b38d71e0 @name="John Snow", @age=21>
# maybe there could be #update_attributes

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant