This project is archived and is in readonly mode.
When an ActiveRecord has a column named 'field', bad behavior happens
Reported by Joe Van Dyk | September 27th, 2009 @ 12:56 AM
I've attached a patch showing the broken test.
If Blarg has a string column named 'field', creating a Blarg instance results in the following:
@@@>> a = Blarg.new => #
a.field = {:elad => 'elad'} ArgumentError: wrong number of arguments (4 for 1)
from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/../../activemodel/lib/active_model/attribute_methods.rb:147:in
attribute_changed?'<br/> from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/../../activemodel/lib/active_model/attribute_methods.rb:147:in
send'
from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/../../activemodel/lib/active_model/attribute_methods.rb:147:in
field_changed?'<br/> from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/active_record/attribute_methods/dirty.rb:153:in
write_attribute'
from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/active_record/attribute_methods/write.rb:13:in
field='<br/> from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:35:in
send'
from
/Users/eladmeidar/projects/bugmash/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:35:in
method_missing'<br/> from (irb):3 @@@
Comments and changes to this ticket
-
Joe Van Dyk September 27th, 2009 @ 01:08 AM
I've attached a patch that includes the broken test and fixes the issue.
-
Joe Van Dyk September 27th, 2009 @ 01:11 AM
- Tag changed from 3, activerecord to 3, activerecord, patch
-
Elad Meidar September 27th, 2009 @ 04:09 AM
+1 verified and applies cleanly on Master, tests pass as well... also, this may probably lead to also closing down #1742
-
rbxbx September 27th, 2009 @ 05:04 AM
was getting this failure:
1) Failure: test_should_allow_except_option_for_list_of_authors(DatabaseConnectedJsonEncodingTest)
[./test/cases/json_serialization_test.rb:179:in `test_should_allow_except_option_for_list_of_authors' ./test/cases/../../lib/../../activemodel/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `__send__' ./test/cases/../../lib/../../activemodel/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `run']:
<"[{"id":1},{"id":2}]"> expected but was <"[{"id":1,"field":null},{"id":2,"field":null}]">. -
rbxbx September 27th, 2009 @ 05:08 AM
- Tag changed from 3, activerecord, patch to 3, activerecord, bugmash, patch
-
sr.iniv.t September 27th, 2009 @ 07:03 PM
+1 on rbxbx's patch (applies cleanly on master and all tests pass). Joe's patch applies, but the test test_should_allow_except_option_for_list_of_authors fails for me.
-
Rizwan Reza January 18th, 2010 @ 01:09 PM
- Assigned user set to Pratik
-
Rizwan Reza January 18th, 2010 @ 01:29 PM
- Tag changed from 3, activerecord, bugmash, patch to 3, 3.0, activerecord, bugmash, patch
I can confirm this error still exists.
+1 verified.
The patch by rbxbx applies cleanly.
-
Rizwan Reza February 12th, 2010 @ 12:46 PM
- Tag changed from 3, 3.0, activerecord, bugmash, patch to 3, 3.0, activerecord, patch
-
Ryan Bigg October 11th, 2010 @ 02:08 AM
- State changed from new to open
- Tag changed from 3, 3.0, activerecord, patch to 3.0, activerecord, patch
- Importance changed from to
Does this error still exist guys?
-
Santiago Pastorino February 2nd, 2011 @ 04:30 PM
- Tag changed from 3.0, activerecord, patch to 30, activerecord, patch
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:30 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 1742 [PATCH] serialize fails when :null => false I created #3274 for the 'field' column name bug.
- 1742 [PATCH] serialize fails when :null => false Looks like we should let #3274 handle this, rather than p...