Yes, as I had explained in my previous email, you will absolutely need to 
rename the objects in the 'type' column when using STI/polymorphism. There are 
several other things to consider as well when making this kind of an object 
name change. 

You can do this directly in SQL (it would be fastest, and works around the 
impossibility of loading these records). I would suggest doing it in SQL in a 
migration.

-Jason


> On Feb 27, 2017, at 12:38 PM, Maurizio De Santis 
> <[email protected]> wrote:
> 
> This seems to break the STI :-( Activity1 is not found as an STI class
> 
> 
> --
> 
> Maurizio De Santis
> 
> 2017-02-24 19:08 GMT+01:00 Jason Fleetwood-Boldt <[email protected] 
> <mailto:[email protected]>>:
> 
> not a Class within a Class, a Class within a Module, like so:
> 
> module Activity
>   class Activity1 < ActivityBase
>   end
> end
> 
> or, alternatively...
> 
> class Activity::Activity1 < ActivityBase
> 
> 
> Note in my example I renamed your base class to "ActivityBase" because I 
> believe if you continue to reference it as simply "Activity" you'll run into 
> namespace problems.
> 
> -Jason 
> 
> 
>> On Feb 24, 2017, at 12:46 PM, Maurizio De Santis 
>> <[email protected] <mailto:[email protected]>> wrote:
>> 
>> # app/models/activity/activity_1.rb
>> class Activity
>>   class Activity1 < Activity
>>   end
>> end
> 
> ----
> 
> Jason Fleetwood-Boldt
> [email protected] <mailto:[email protected]>
> http://www.jasonfleetwoodboldt.com/writing 
> <http://www.jasonfleetwoodboldt.com/writing>
> 
> If you'd like to reply by encrypted email you can find my public key on 
> jasonfleetwoodboldt.com <http://jasonfleetwoodboldt.com/> (more about setting 
> GPG: https://gpgtools.org <https://gpgtools.org/>) 
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ruby on Rails: Core" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/rubyonrails-core/krboJIieoXk/unsubscribe 
> <https://groups.google.com/d/topic/rubyonrails-core/krboJIieoXk/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/rubyonrails-core 
> <https://groups.google.com/group/rubyonrails-core>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/rubyonrails-core 
> <https://groups.google.com/group/rubyonrails-core>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

----

Jason Fleetwood-Boldt
[email protected]
http://www.jasonfleetwoodboldt.com/writing

If you'd like to reply by encrypted email you can find my public key on 
jasonfleetwoodboldt.com <http://jasonfleetwoodboldt.com/> (more about setting 
GPG: https://gpgtools.org) 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to