This project is archived and is in readonly mode.
[PATCH] Fix 'warning: method redefined' in attr_accessor_with_default for ruby 1.9.2
-
Damien MATHIEU
Isn't there something more globally defined which would just need be to be included instead of defining the capture_stderr method ?
-
Marjan Krekoten'
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'
- Assigned user set to José Valim
-
Marjan Krekoten'
- 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'
Ticket with capture resolved. Attached updated patch.
-
Marjan Krekoten'
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 spacesI've attached updated patch.
-
Marjan Krekoten'
- Assigned user changed from José Valim to Santiago Pastorino
-
Santiago Pastorino
- 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'
Ok, I removed test. But I think
attr_accessoris better solution. Withattr_accessorwe 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
- State changed from open to resolved
(from [1b7d30bfc925562cffff10db2a0388770e9bc06c]) Fix 'warning: method redefined' [#5551 [PATCH] Fix 'warning: method redefined' in attr_accessor_with_default for rub... state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/1b7d30bfc925562cffff10db2a0388...
