Hi guys, I'm part way through a RoR application, for some reason
whenever I add new controllers (using scaffold) I get an uninitialized
constant [name of controller] error.
The first few controllers work fine, the only thing I can see that I've
changed is the layout file (but scaffold creates a new layout for each
controller so can't see that being the problem). You can all probably
tell I'm new to rails so hoping this is some newb error...
Just for clarity, Ive been adding controllers as I go, but the last two
added have given this error straight after running scaffold (I haven't
made any changes to them).
Hi guys, I'm part way through a RoR application, for some reason
whenever I add new controllers (using scaffold) I get an uninitialized
constant [name of controller] error.
The first few controllers work fine, the only thing I can see that
I've
changed is the layout file (but scaffold creates a new layout for
each
controller so can't see that being the problem). You can all probably
tell I'm new to rails so hoping this is some newb error...
Well it's nice that we can see the error messages, but the code would
be more helpful (eg what's on exercises_controller on line 12 ?)
def list
@exercises_pages, @exercises = paginate :exercises, :per_page => 10
end
which is the same as was generated for the previous controllers.
The page should be generating a list of exercises currently in the
database, it might be worth pointing out that exercises/new works, so
seems to be just the list method.
def list
@exercises_pages, @exercises = paginate :exercises, :per_page => 10
end
is the Class name Exercise or Exercises. I'm going to guess that it's
the latter. paginate is being smart and assuming that if you say
exercises, then the name of the model is the singular (ie exercise).
I'll further guess that the difference is that when you created the
scaffold you've recently been using the plural form, whereas you
should be using the singular.