I found this pretty strange. I have an ActiveRecord
object with x & y coordinates called X and Y
I can call the method "y" directly with no problems,
but when I try to call it using send I get an
ArgumentError.
>> es.y
=> 30.468257171342
>> es.send(:y)
ArgumentError: wrong number of arguments (0 for 1)
from (irb):7:in `y''
from (irb):7
The method "x" seems to work fine.
>> es.x
=> -84.2674903100158
>> es.send(:x)
=> -84.2674903100158
Any suggested solutions/workarounds short of
renaming columns in my table?
Ron M wrote:> >> es.y > => 30.468257171342> >> es.send(:y) > ArgumentError: wrong number of arguments (0 for 1) > from (irb):7:in `y'' > from (irb):7Hmm... thanks to someone on ruby-lang, I found the solution. I guess ''y'' is being handled by method_missing, not by y (which apparently is a private method of some base class of activerecord?) >> es.send(:method_missing,:y) => 30.468257171342 >>