deprecated returning method usage
mirlord opened this issue · comments
Class TagList (method #from, line 87) uses deprecated rails-method 'returning':
http://guides.rubyonrails.org/2_3_release_notes.html#objecttap-backport
It causes a critical fail on rails-3.0.0rc/ruby-1.8.7-p299.
Possible solutions are:
- Clear: use Object#tap method
def from(source)
new.tap do |tag_list|
case source
...
- Dirty, but compatible with older versions of ruby and rails - to define own method returning (as a static in TagList):
def returning( obj )
return obj unless block_given?
if obj.respond_to? :tap
obj.tap { |*x| yield( *x ) }
else
yield( obj )
return obj
end
end
(need to say, I don't like this way and I think something better exists, but this way works for me).
Thanks. I've fixed the problem.