Object#type is deprecated; use Object#class

Could it be because you have a "type" column in your models which
you're either validating on or accessing? If so, this could help:

http://wiki.pluginaweek.org/Type_attributes

Daniel Talsky wrote:

Aaron Pfeifer wrote:

Could it be because you have a "type" column in your models which
you're either validating on or accessing? If so, this could help:

http://wiki.pluginaweek.org/Type_attributes

On Sep 28, 4:12 pm, Daniel Talsky <rails-mailing-l...@andreas-s.net>

There's a few attributes WITH type in the name "question_type", but none
actually CALLED "type". Would that still do it? Any other ideas?

Daniel, did you ever find an answer to this one? I'm getting exactly the
same behavior. I have attributes with "type" in the name, but none
exactly named "type".

Gabe H. wrote:

Daniel Talsky wrote:

Aaron Pfeifer wrote:

Could it be because you have a "type" column in your models which
you're either validating on or accessing? If so, this could help:

http://wiki.pluginaweek.org/Type_attributes

On Sep 28, 4:12 pm, Daniel Talsky <rails-mailing-l...@andreas-s.net>

There's a few attributes WITH type in the name "question_type", but none
actually CALLED "type". Would that still do it? Any other ideas?

Daniel, did you ever find an answer to this one? I'm getting exactly the
same behavior. I have attributes with "type" in the name, but none
exactly named "type".

I encountered a similar problem when calling :type on an instance that
(misbehaved and) overrode :type (Mysqlcolumn in this instance). I was
seeing the above error message when I had a nil object and was still
sending type (hence, Object#type handled). The fix was something like:

Before:

find_column(:attribute).type

After:

find_column(:attribute).type if find_column(:attribute)

If you really have a database column called "type", then you should be using Single-Table Inheritance (because ActiveRecord is going to make that assumption). You can change the column that AR expects to use to a name different than 'type' (look it up) or you can reference u['type'] or u[:type] rather than u.type to avoid the warning.

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com