Marcelo de Moraes Serpa
2012-May-22 02:35 UTC
Kernel#send behaving strangely with ActiveRecord attribute methods
I''m going through an weird behavior with Kernel#send and *I think* it might be related to ActiveRecord (I''m using Rails 2.3.11). I have a User model that has the following fields: email: String status: Integer (among others) If I do: some_arg_that_might_come_in_a_local_var = true method = ''email'' @user.send(method,some_arg_that_might_come_in_a_local_var) => ''user-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org'' So, email doesn''t expect the additional var (it''s an AR accessor AFAIK, so it should not accept any args), but it doesn''t throw the ArgumentError exception. The some_arg_that_might_come_in_local_var is an argument that will be passed to certain methods that DO accept a second boolean argument, but it happens that sometimes the method argument sent to send can be email or status. But if I do: some_arg_that_might_come_in_a_local_var = true @user.send(method,some_arg_that_might_come_in_a_local_var) ArgumentError: wrong number of arguments (1 for 0) I then get the exception. Any ideas? Cheers, - Marcelo. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.