I''d like one of my AR models to have a subclass. I''d like that subclass to live in a folder that is named the same as the model. For example. models/person.rb (AR model with behaviour) models/person/processor.rb (class Person::Processor) Am I right in thinking that this isn''t possible? My tests seem to indicate that it isn''t. Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Ok, so this is possible. At the bottom of the AR model file, use require_or_load for each of the files in the subfolder. class Person < ActiveRecord::Base; end require_or_load File.dirname(__FILE__) + ''/person/processor.rb'' Chris On 8/22/06, Chris Roos <chrisjroos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''d like one of my AR models to have a subclass. I''d like that > subclass to live in a folder that is named the same as the model. For > example. > > models/person.rb (AR model with behaviour) > models/person/processor.rb (class Person::Processor) > > Am I right in thinking that this isn''t possible? My tests seem to > indicate that it isn''t. > > Chris >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 8/22/06, Chris Roos <chrisjroos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''d like one of my AR models to have a subclass. I''d like that > subclass to live in a folder that is named the same as the model. For > example. > > models/person.rb (AR model with behaviour) > models/person/processor.rb (class Person::Processor) > > Am I right in thinking that this isn''t possible? My tests seem to > indicate that it isn''t.This works on edge. jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---