I was experiment in the console and I did this:
c = Client.new
a = c.to_a
which gave this:
(irb):14: warning: default `to_a'' will be obsolete
so, since to_a is depreciated then I will use to_ary, right? No. you
can''t.
a = c.to_ary
NoMethodError: undefined method `to_ary'' for #<Client:0xb7f08b80>
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:205:in
`method_missing''
from (irb):15
from :0
Now, the interesting thing here is that ''to_ary'' was removed
from
ActiveRecord on ticket 177 way back before 1.0. Apparently, the method
missing handling of ActiveRecord makes ''to_ary'' redundant.
So, my
questions are, why doesn''t AR provide me with a dynamic
''to_ary'' method
when I call it from the console and what am I suppose to load in the
console to get this method?
I fully realize that I can continue to use to_a, as I shall since I have
no option. But what happens when to_a actually disappears? Not that it
ever will in reality, but that depreciation warning is annoying none the
less and I do not wish to turn off all warnings to get rid of one.
--
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 post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---