Dark Ambient
2006-Oct-23 16:00 UTC
Does every model need a corresponding Controller and View ?
or is there a way to intialize a model in another controller ? Right now I''m getting uninitialized constant CandidatesController:Canindustry TIA stuart -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Long
2006-Oct-23 16:17 UTC
Re: Does every model need a corresponding Controller and View ?
Dark Ambient wrote:> or is there a way to intialize a model in another controller ? > Right now I''m getting > > uninitialized constant CandidatesController:Canindustry >The short answer is no. Just make sure Canindustry is correctly spelled. Perhaps its CanIndustry if the model file name is can_industry. Another option (some times required) is to add the following in the controller. class FooController model ''can_industry'' # or is it ''canindustry'' ... end Long www.edgesoft.ca --~--~---------~--~----~------------~-------~--~----~ 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 10/23/06, Long <long755-bJEeYj9oJeDQT0dZR+AlfA@public.gmane.org> wrote:> > Dark Ambient wrote: > > or is there a way to intialize a model in another controller ? > > Right now I''m getting > > > > uninitialized constant CandidatesController:Canindustry > > > The short answer is no. Just make sure Canindustry is correctly spelled. > Perhaps its CanIndustry if the model file name is can_industry. > > Another option (some times required) is to add the following in the controller. > > class FooController > model ''can_industry'' # or is it ''canindustry'' > ... > end >What Long said. Plus, it looks like your scope operator was mistyped. Should be :: instead of :. -- James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Long
2006-Oct-23 16:29 UTC
Re: Does every model need a corresponding Controller and View ?
JDL wrote:> > On 10/23/06, Long <long755-bJEeYj9oJeDQT0dZR+AlfA@public.gmane.org> wrote: > > > > Dark Ambient wrote: > > > or is there a way to intialize a model in another controller ? > > > Right now I''m getting > > > > > > uninitialized constant CandidatesController:Canindustry > > > > > The short answer is no. Just make sure Canindustry is correctly spelled. > > Perhaps its CanIndustry if the model file name is can_industry. > > > > Another option (some times required) is to add the following in the controller. > > > > class FooController > > model ''can_industry'' # or is it ''canindustry'' > > ... > > end > > > > What Long said. Plus, it looks like your scope operator was mistyped. > Should be :: instead of :. >Good catch James! Long --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dark Ambient
2006-Oct-23 16:32 UTC
Re: Does every model need a corresponding Controller and View ?
On 10/23/06, JDL <jamesludlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 10/23/06, Long <long755-bJEeYj9oJeDQT0dZR+AlfA@public.gmane.org> wrote: > > > > Dark Ambient wrote: > > > or is there a way to intialize a model in another controller ? > > > Right now I''m getting > > > > > > uninitialized constant CandidatesController:Canindustry > > > > > The short answer is no. Just make sure Canindustry is correctly spelled. > > Perhaps its CanIndustry if the model file name is can_industry. > > > > Another option (some times required) is to add the following in the > controller. > > > > class FooController > > model ''can_industry'' # or is it ''canindustry'' > > ... > > end > > > > What Long said. Plus, it looks like your scope operator was mistyped. > Should be :: instead of :. > > -- Jamesthe model for clarification is - class Canindustry < ActiveRecord::Base with file name spelled canindustry.rb Things seemed to be spelled correctly. I tried adding model ''canindustry'' and was met with undefined method `model'' for #<CandidatesController:0x8481ba0> Not sure what''s going on . Stuart -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Walton
2006-Oct-23 17:13 UTC
Re: Does every model need a corresponding Controller and View ?
Hi Stuart, Dark Ambient wrote:> is there a way to intialize a model in another controller ?Just include the following line in your controller. model :model_name hth, Bill --~--~---------~--~----~------------~-------~--~----~ 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 10/23/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > the model for clarification is - > class Canindustry < ActiveRecord::Base > > with file name spelled canindustry.rb > > Things seemed to be spelled correctly. I tried adding model ''canindustry'' > and was met with > > undefined method `model'' for > #<CandidatesController:0x8481ba0> > > Not sure what''s going on . > StuartWhat are you trying to do? You shouldn''t have to do anything special to use a model in a controller. The models (by design) have no clue about controllers at all. They aren''t tied to any specific controller, unless you''ve hacked something in that we don''t know about. If you post the code that is actually breaking, we might be able to help. Otherwise, it''s just guessing. -- James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dark Ambient
2006-Oct-23 17:40 UTC
Re: Does every model need a corresponding Controller and View ?
On 10/23/06, JDL <jamesludlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 10/23/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > the model for clarification is - > > class Canindustry < ActiveRecord::Base > > > > with file name spelled canindustry.rb > > > > Things seemed to be spelled correctly. I tried adding model > ''canindustry'' > > and was met with > > > > undefined method `model'' for > > #<CandidatesController:0x8481ba0> > > > > Not sure what''s going on . > > Stuart > > What are you trying to do? You shouldn''t have to do anything special > to use a model in a controller. The models (by design) have no clue > about controllers at all. They aren''t tied to any specific > controller, unless you''ve hacked something in that we don''t know > about. > > If you post the code that is actually breaking, we might be able to > help. Otherwise, it''s just guessing.Hey guys , it''s working now ! For whatever reason writing model ''mymodel'' didn''t take and got an exception thrown. model :mymodel though did the trick. Very nice.Appreciate all the help. Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---