or is there a way to intialize a model in another controller ?
Right now I’m getting
uninitialized constant CandidatesController:Canindustry
TIA
stuart
–
or is there a way to intialize a model in another controller ?
Right now I’m getting
uninitialized constant CandidatesController:Canindustry
TIA
stuart
–
Dark A. wrote:
or is there a way to intialize a model in another controller ?
Right now I’m gettinguninitialized 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
On 10/23/06, Long [email protected] wrote:
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
On 10/23/06, JDL [email protected] wrote:
The short answer is no. Just make sure Canindustry is correctly spelled.
What Long said. Plus, it looks like your scope operator was mistyped.
Should be :: instead of :.– James
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
–
JDL wrote:
Perhaps its CanIndustry if the model file name is can_industry.
Should be :: instead of :.
Good catch James!
Long
Hi Stuart,
Dark A. 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
On 10/23/06, Dark A. [email protected] wrote:
#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.
– James
On 10/23/06, JDL [email protected] wrote:
‘canindustry’
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs