Iazel wrote in post #1157000:
> However, if you still don't like this, you can just check if the last
> parameter is a Fixnum (duck typing style) and act accordingly:
>
>  x = n.respond_to?(:to_int) ? n.to_int : g(c)

Isn't this a bit risky? After all, Card the class of n derives from 
ActiveRecord::Base, i.e. a class, which I can't control. Now imagine 
that in a new version of Rails, this class would receive a to_int method 
(for example, to implicitly convert a model object into the id of the 
object). This would break my code.

Ronald

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0512827d7d5bb137f82314654cd5da17%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to