This is the first time I''m working with Engine''s in Rails, let alone in Rails 3. I basically followed these steps to set up the mountable app: http://blog.dynamic50.com/index.php/2010/02/rails-3-0-mount-multiple-apps-as-engines/ Now that the mountable app is built, I''m moving on to create the container app. In doing so, however, I am having trouble accessing the models in the mounted app. Shop is a model I have the the mounted app, and when I try to access it in the container app, this is returned:>> Shop.first=> NoMethodError: undefined method `first'' for Shop:Module Strangely enough, however, 3 of the mounted app''s 19 models are accessible in the container app. Shop.class.name returns "Module" while Employee.class.name returns "Class" (Employee is a working model in the container app). I''m quite lost on this. Any help is greatly appreciated! Thanks, Angelo -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Okay, it looks like Rails is pulling an April Fools on me. It like 18 of the 19 models are accessible. I tried to list all the models using: ActiveRecord::Base.send(:subclasses).each { |model| puts model.name } and it only returned three of the models. Accessing all the models directly (typing "Image" in the console, for example) accesses them correctly. My Shop model, however, is still causing problems. Shop is definitely accessible in the mounted app, but acts as if it does not exist in the container app. Angelo On Apr 1, 3:11 pm, Angelo Ashmore <studiopd....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is the first time I''m working with Engine''s in Rails, let alone > in Rails 3. I basically followed these steps to set up the mountable > app:http://blog.dynamic50.com/index.php/2010/02/rails-3-0-mount-multiple-... > > Now that the mountable app is built, I''m moving on to create the > container app. In doing so, however, I am having trouble accessing the > models in the mounted app. > > Shop is a model I have the the mounted app, and when I try to access > it in the container app, this is returned: > > >> Shop.first > > => NoMethodError: undefined method `first'' for Shop:Module > > Strangely enough, however, 3 of the mounted app''s 19 models are > accessible in the container app. Shop.class.name returns "Module" > while Employee.class.name returns "Class" (Employee is a working model > in the container app). > > I''m quite lost on this. Any help is greatly appreciated! > > Thanks, > Angelo-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think I just realized why this is happening. The container app is just a sample for testing out the mounted app, and I named it "Shop". I imagine there''s some kind of conflict going on between the Shop defined in application.rb and the Shop defined in the model. Gonna go test this now, but I think that pretty much solves this mystery. On Apr 2, 9:33 am, Angelo Ashmore <studiopd....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Okay, it looks like Rails is pulling an April Fools on me. It like 18 > of the 19 models are accessible. I tried to list all the models using: > > ActiveRecord::Base.send(:subclasses).each { |model| puts model.name } > > and it only returned three of the models. Accessing all the models > directly (typing "Image" in the console, for example) accesses them > correctly. > > My Shop model, however, is still causing problems. Shop is definitely > accessible in the mounted app, but acts as if it does not exist in the > container app. > > Angelo > > On Apr 1, 3:11 pm, Angelo Ashmore <studiopd....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > This is the first time I''m working with Engine''s in Rails, let alone > > in Rails 3. I basically followed these steps to set up the mountable > > app:http://blog.dynamic50.com/index.php/2010/02/rails-3-0-mount-multiple-... > > > Now that the mountable app is built, I''m moving on to create the > > container app. In doing so, however, I am having trouble accessing the > > models in the mounted app. > > > Shop is a model I have the the mounted app, and when I try to access > > it in the container app, this is returned: > > > >> Shop.first > > > => NoMethodError: undefined method `first'' for Shop:Module > > > Strangely enough, however, 3 of the mounted app''s 19 models are > > accessible in the container app. Shop.class.name returns "Module" > > while Employee.class.name returns "Class" (Employee is a working model > > in the container app). > > > I''m quite lost on this. Any help is greatly appreciated! > > > Thanks, > > Angelo-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.