Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #update_attributes in mass assignment #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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