-
Notifications
You must be signed in to change notification settings - Fork 190
Make sure raise error if you try to overwrite field name that is already defined in Object #185
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
base: master
Are you sure you want to change the base?
Make sure raise error if you try to overwrite field name that is already defined in Object #185
Conversation
|
I don't know why we cannot use these names as attributes...(even if just a warning). |
|
@syguer I haven't read the source code enough yet, so I don't know the details, but if I define it with same name as a method of the Object class, It seems the Object class to be executed at runtime. I checked the behavior of ActiveRecord. create_table :countries do |t|
t.string :display
t.timestamps
endclass Country < ApplicationRecord
endcountry = Country.new(display: 'hoge')
country.display
# => "hoge"ActiveRecord seems to be overwritten with the defined field name. |
|
I have found the relevant part, so write it down for the time being. If I remove the I tried to read what implementation of |
|
@harada4atsushi |
…ady defined in Object
cd61ad3 to
0f61455
Compare
|
@syguer Apparently, it seems to be a change to avoid overriding the methods implemented in the class when defining fields using ActiveYaml. This is not limited ActiveYaml, methods implemented in classes that inherit from ActiveHash::Base should not be overwritten by Therefore, it has been changed to |
|
sorry, this is old but simple. Not sure why it stalled.
I like this solution and it looks pretty good. Any thoughts? |
|
Modifying a class in a Still concerned about hierarchical classes and the |
From the request of #184 , an error is generated when you try to overwrite the method already defined in Object.
Is it better to use warnings instead of errors because the impact is great?