Thanks in advance for being patient with this rails newbie
When I do the STI example in AWDWR i get a warning: Object#type is
deprecated; use Object#class
What does this mean?
How should I change the following code?
This is from page 342 AWDWR
create_table :people, :force => true do |t|
t.column :type, :string
Can I change this to
t.column :kind, :string with no ill effects? Or is their something
special about a column with the name type?
I read this on http://api.pluginaweek.org/type_attributes/
In Ruby 1.8, type is a deprecated attribute replaced by the class
method. However, since type is also used in class inheritance within
ActiveRecord, it will not allow you to access the type attribute as
defined in a model’s table. Instead, it will return the actual class
using the deprecated method. This bug fix accesses the actual
attribute instead if type is defined as a column in the model’s table.
Should I redefine type as suggested here or is there a better way?
module PluginAWeek #:nodoc:
Allow +type+ to be accessed as a attribute
# Retrieves the current value for +type+
read_attribute(:type) : super