Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Deprecate ClassMethods.attributes

  • Loading branch information...
commit 68ce27f05cccb7ca494819571e19490a41b84132 1 parent 28a01ee
@solnic authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  README.md
  2. +10 −0 lib/virtus/class_methods.rb
View
2  README.md
@@ -41,7 +41,7 @@ class User
end
user = User.new(:name => 'Piotr', :age => 28)
-user.attributes # => { :name => "Piotr", :age => 28 }
+user.attribute_set # => { :name => "Piotr", :age => 28 }
@dkubb Collaborator
dkubb added a note

@solnic did you meant to change this example too? I thought the instances still had the #attributes method.

@solnic Owner
solnic added a note

oops thanks! I'll fix in a second

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
user.name # => "Piotr"
View
10 lib/virtus/class_methods.rb
@@ -46,6 +46,16 @@ def attribute_set
@attribute_set = AttributeSet.new(parent)
end
+ # @see Virtus::ClassMethods.attribute_set
+ #
+ # @deprecated
+ #
+ # @api public
+ def attributes
+ warn "#{self}.attributes is deprecated. Use #{self}.attribute_set instead: #{caller.first}"
+ attribute_set
+ end
+
protected
# Set up the anonymous module which will host Attribute accessor methods
Please sign in to comment.
Something went wrong with that request. Please try again.