-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hello I'm facing the issue with inheritance, attributes are not being copied.
Ruby 2.3.1
model_attribute (3.1.1)
require 'model_attribute'
class Person
extend ModelAttribute
attribute :name, :string
attribute :last_name, :string
def initialize(attributes = {})
set_attributes(attributes)
end
end
class User < Person
def initialize(attributes = {})
super(attributes)
self.name = "This is an error"
end
end
User.attributes # nil
User.new({})
# /Users/soto/.rvm/gems/ruby-2.3.1/gems/model_attribute-3.1.1/lib/model_attribute.rb:87:in `read_attribute': undefined method `include?' for nil:NilClass (NoMethodError)
# from /Users/soto/.rvm/gems/ruby-2.3.1/gems/model_attribute-3.1.1/lib/model_attribute.rb:66:in `write_attribute'
# from /Users/soto/.rvm/gems/ruby-2.3.1/gems/model_attribute-3.1.1/lib/model_attribute.rb:27:in `name='
# from script.rb:17:in `initialize'
# from script.rb:22:in `new'
# from script.rb:22:in `<main>'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels