Jump to content

The ultimate community for Ruby on Rails developers.


Photo

The "column_types" method and Rails 4


  • Please log in to reply
4 replies to this topic

#1 F2Andy

F2Andy

    Passenger

  • Members
  • 3 posts

Posted 15 August 2013 - 01:42 PM

I am trying to upgrade to Rails 4, and keep getting warning about a "column_types" method.
 

> Post.all

DEPRECATION WARNING: the object returned from `select_all` must respond to `column_types`

> Post.count

NoMethodError: undefined method `column_types' for [{"count"=>67}]:Array

I am using Rails 4.0.0, JRuby 1.7.4, PostgreSQL, Windows 7...



#2 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 15 August 2013 - 03:18 PM

I am trying to upgrade to Rails 4, and keep getting warning about a "column_types" method.
 

> Post.all

DEPRECATION WARNING: the object returned from `select_all` must respond to `column_types`

> Post.count

NoMethodError: undefined method `column_types' for [{"count"=>67}]:Array

I am using Rails 4.0.0, JRuby 1.7.4, PostgreSQL, Windows 7...

 

 

Take a look at this post here and see if that explains the Model.all


  • michalgritzbach likes this
Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#3 F2Andy

F2Andy

    Passenger

  • Members
  • 3 posts

Posted 16 August 2013 - 10:02 AM

No, that does not help, besides saying that Model.all has changed. Okay, Model.all now returns something different (a relationship, rather than a collection of records) but why the deprecation warning?



#4 dowdrake

dowdrake

    Passenger

  • Members
  • 2 posts

Posted 23 August 2013 - 01:56 AM

I am trying to upgrade to Rails 4, and keep getting warning about a "column_types" method.

 

 

It looks to me like that error is coming from activerecord-4.0.0/lib/active_record/querying.rb, line 42.  It's Maybe you need to update your database adapter gem.

 

What database adapter are you using?  Could you post the stack trace of the error?



#5 Vell

Vell

    Dispatcher

  • Members
  • 42 posts
  • LocationWashington, DC

Posted 23 August 2013 - 04:01 AM

I agree with dowdrake. I think there is something going on with your setup. I am using 4.0 and am using Model.all without any issue. I also assume that you are following the upgrade guide to make sure everything is in order (as best as possible)?

 

 

Not sure what version of rails your upgrading from but maybe these will help:

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users