Rails 1.2.5 - : warning: Object#type is deprecated; use Object#class

Hi

After updating to 1.2.5, I am getting : warning: Object#type is deprecated; use Object#class for this code snippet

AuditTrail.create(:record_id => record.id, :record_type => record.type.name,                       :event => event, :user_id =>user, :name=>username)

Which part of the the above-mentioned code should I change in order to remove the deprecation warning ?

Hi

Have isolated deprecation to :-

:record_type => record.type.name,

How to make this into Object#class syntax ?

You can do record.class. This returns a string representation of the class.

-Bill

CCH wrote:

CCH wrote:

Hi

Have isolated deprecation to :-

:record_type => record.type.name,

How to make this into Object#class syntax ?

Just changing to class instead of type should work, according to the Ruby docs Object#type is a deprecated synonym for Object#class

:record_type => record.class.name,

http://www.ruby-doc.org/core/classes/Object.html#M000347

Hi Anthony

How to make this into Object#class syntax ?

Just changing to class instead of type should work, according to the Ruby docs Object#type is a deprecated synonym for Object#class

:record_type => record.class.name,

cch: This works ! Thanx to you and also Bill Pratt !