On Feb 18, 2013, at 7:01 PM, Jaime B. wrote:
> MichaelLatta wrote in post #227241:
>> The 'type' method is a Ruby method for the class of an object.
>
> This is not a Ruby method. This is part of ActiveRecord, and is used by
> Rails to manage single-table inheritance.
While it is true that 'type' is not a method in Ruby 1.9, it was in earlier versions:
irb1.8.7> 1.type
(irb):1: warning: Object#type is deprecated; use Object#class
#1.8.7 => Fixnum
It is something to keep in mind whenever looking at older code.
-Rob
>
> I'm adding a solution for future askers. This applies to Rails 3:
>
> class ExampleModel < ActiveRecord::Base
> set_inheritance_column do
> 'disabled'
> end
> end
>
>
> This changes the name of the column that ActiveRecord looks for, to use
> for STI. As long as you pick something that doesn't actually match any
> of your column names, it has the effect of disabling inheritance
> altogether.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment