This project is archived and is in readonly mode.
[PATCH] Fix 'warning: method redefined' in attr_accessor_with_default for ruby 1.9.2
Reported by Marjan Krekoten' | September 4th, 2010 @ 11:22 AM | in 3.0.2
Test and fix are attached.
As side effect should be little faster because avoids future calls
to attr_reader every time new value assigned.
Comments and changes to this ticket
-
Damien MATHIEU September 4th, 2010 @ 11:32 AM
Isn't there something more globally defined which would just need be to be included instead of defining the capture_stderr method ?
-
Marjan Krekoten' September 4th, 2010 @ 11:35 AM
Maybe. I tried to search, but didn't find.
Well, if such code exists and you know about it, please tell me and I'll update test. -
Marjan Krekoten' September 5th, 2010 @ 09:07 PM
- Assigned user set to José Valim
-
Rohit Arondekar September 12th, 2010 @ 11:34 AM
- Importance changed from to Low
I think you can try using:
capture(:stderr) { ... }
-
Marjan Krekoten' September 16th, 2010 @ 07:46 PM
- Tag set to activesupport, patch, warnings
Well, you are right. But there is one problem. It is not available in active_support for now. I've created a ticket for that https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets... . If it will be committed, I'll fix this patch. So I think this patch can be hold until then.
-
Marjan Krekoten' September 18th, 2010 @ 09:50 PM
Ticket with capture resolved. Attached updated patch.
-
Marjan Krekoten' September 18th, 2010 @ 10:02 PM
Oops, previous patch caused another warning:
test/core_ext/module/attr_accessor_with_default_test.rb:38: warning: ambiguous first argument; put parentheses or even spaces
I've attached updated patch.
-
Marjan Krekoten' September 22nd, 2010 @ 08:40 PM
- Assigned user changed from José Valim to Santiago Pastorino
-
Santiago Pastorino September 25th, 2010 @ 12:17 AM
- State changed from new to open
- Milestone cleared.
Marjan, you don't need to provide test when you fix a warning. Also the proper fix is to remove the method #{sym} before calling attr_reader #{sym}
-
Marjan Krekoten' September 25th, 2010 @ 09:01 AM
Ok, I removed test. But I think
attr_accessor
is better solution. Withattr_accessor
we avoid any methods rewriting as soon as new value assigned. So every future value assigning will avoid removing reader, then defining new one.I've created pull request with updated fix.
http://github.com/rails/rails/pull/52 -
Repository September 25th, 2010 @ 10:07 AM
- State changed from open to resolved
(from [1b7d30bfc925562cffff10db2a0388770e9bc06c]) Fix 'warning: method redefined' [#5551 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/1b7d30bfc925562cffff10db2a0388...
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
- 5551 [PATCH] Fix 'warning: method redefined' in attr_accessor_with_default for ruby 1.9.2 (from [1b7d30bfc925562cffff10db2a0388770e9bc06c]) Fix 'wa...