If I have a component with a model where does it go in the components tree? I made a model dir in my components dir but I get "This error occured while loading the following files:" _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 9/23/05, Xavier Toth <txtoth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If I have a component with a model where does it go in the components tree? > I made a model dir in my components dir but I get > "This error occured while loading the following files:"The thing about components is they must be in a module for rails to find them: components/your_component/model.rb class YourComponent::Model < ActiveRecord::Base end Of course, you can name it whatever you want, but you will need an explicit require statement in environment.rb. require_dependency ''components/your_component/model'' -- rick http://techno-weenie.net
On Sep 23, 2005, at 2:00 PM, Rick Olson wrote:> On 9/23/05, Xavier Toth <txtoth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> If I have a component with a model where does it go in the components >> tree? >> I made a model dir in my components dir but I get >> "This error occured while loading the following files:" > > The thing about components is they must be in a module for rails to > find them: > > components/your_component/model.rb > > class YourComponent::Model < ActiveRecord::Base > end > > Of course, you can name it whatever you want, but you will need an > explicit require statement in environment.rb. > > require_dependency ''components/your_component/model''This should not be necessary so long as you follow proper naming conventions. Unless that''s what you meant and I just read it the wrong way ... -- Scott Barron Lunchbox Software http://lunchboxsoftware.com http://lunchroom.lunchboxsoftware.com http://rubyi.st
Am 23.09.2005 um 20:00 schrieb Rick Olson:> On 9/23/05, Xavier Toth <txtoth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> If I have a component with a model where does it go in the >> components tree? >> I made a model dir in my components dir but I get >> "This error occured while loading the following files:" >> > > The thing about components is they must be in a module for rails to > find them: > > components/your_component/model.rb > > class YourComponent::Model < ActiveRecord::Base > endUsing 13.1 Rails, I have to use class Model < ActiveRecord::Base end Without the namespace prefix. Otherwise, I got errors. Regards Manuel Holtgrewe