# To\_ary removed from ActiveRecord

**URL:** <https://www.ruby-forum.com/t/to-ary-removed-from-activerecord/132272>\
**Category:** Rails\
**Created:** [March 18, 2008, 4:50pm UTC](https://www.ruby-forum.com/t/to-ary-removed-from-activerecord/132272 "2008-03-18T16:50:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 18, 2008, 4:50pm UTC](https://www.ruby-forum.com/t/to-ary-removed-from-activerecord/132272/1 "2008-03-18T16:50:04Z")

</div>

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.
