I thought I was LONG past something like this, but I guess not.
I’m starting a new application. I created my database, one model
(‘testimonials’ for the testimonial table), and an admin controller. To
get a starting point, I added one line:
scaffold :testimonials
When I try to open the admin controller (localhost:3000/admin), I get
the following error:
uninitialized constant Testimonial
RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace
This error occured while loading the following files:
testimonial.rb
All I’ve done is add the scaffold line. Can someone suggest what might
be wrong?
In my case all names convetions are ok, and I am also getting the very
same
error.
The interesting thing is that if you create a static scaffold named
“testimonial” using script\generate, then the controller on which
“scaffold
:testimonial” is defined will work fine. If you destroy the static
scaffold,
the you have the same error again.
At risk of sounding like a broken record, are you absolutely sure the
pluralization is correct in every instance? I just created exactly the
same thing and it worked perfectly fine.
I created a table called “testimonials”. (Notice the plural.)
I generated a scaffold called “testimonial”. (Notice there is NO
plural.)
I generated a controller called “admin”.
I added the line scaffold :testimonial to the admin controller
(again, NO plural).
The above actions worked perfectly for me. I tried deviating the
pluralization in some of the above steps and I received exactly the same
error message. So if you’re sure you did all of the above then I believe
I’ve hit the limit of my expertise in this area.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.