Validations.rb:81 error

In my Mongrel logs, I am getting this:

…active_record/validations.rb:81: warning: Object#type is deprecated;
use Object#class

That piece of code is:

def add_on_blank(attributes, msg = @@default_error_messages[:blank])
  for attr in [attributes].flatten
    value = @base.respond_to?(attr.to_s) ? @base.send(attr.to_s) :

@base[attr.to_s] <<< line 81
add(attr, msg) if value.blank?
end
end

I don’t see what Ruby is complaining about. Anyone have any ideas?

Thanks,
pedz

just a guess, but have you given any of your models a “type” field in
the database? rails by default will think that your model is using
STI if you have a “type” field.

On Oct 13, 9:33 am, Perry S. [email protected]

Jeff Emminger wrote:

just a guess, but have you given any of your models a “type” field in
the database? rails by default will think that your model is using
STI if you have a “type” field.

On Oct 13, 9:33 am, Perry S. [email protected]

Thanks but, no… I don’t see just a “type” field. I looked in my
migrate files and then I did a rake db:schema:dump and looked in the
dump file. I have things like “item_type” but not just “type”.

I’m using edge rails – if that matters.

Perry S. wrote:

Jeff Emminger wrote:

just a guess, but have you given any of your models a “type” field in
the database? rails by default will think that your model is using
STI if you have a “type” field.

On Oct 13, 9:33 am, Perry S. [email protected]

Thanks but, no… I don’t see just a “type” field. I looked in my
migrate files and then I did a rake db:schema:dump and looked in the
dump file. I have things like “item_type” but not just “type”.

I’m using edge rails – if that matters.

I might have found it. I use to have a field “type” but I changed it.
But I goofed and did not change my “validates_presence_of :type”.

I bet thats it.

Thanks.

aha… you should have caught that in your unit tests :wink:

On Oct 13, 7:12 pm, Perry S. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs