Uninitialized constant

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…

the failing controllers can be found at
http://spotter.derbyproject.com/exercises/list
http://spotter.derbyproject.com/updates/

and working ones are here
http://spotter.derbyproject.com/users

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).

thanks!

On 13 Apr 2008, at 15:35, Lee F. wrote:

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 :slight_smile: (eg what’s on exercises_controller on line 12 ?)

Fred

good call… sorry mate

line 11-13 look like this

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.

cheers.

On 13 Apr 2008, at 15:58, Lee F. wrote:

good call… sorry mate

line 11-13 look like this

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.

Fred

Frederick C. wrote:

On 13 Apr 2008, at 15:58, Lee F. wrote:

good call… sorry mate

line 11-13 look like this

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.

Fred

I just ran scaffold exercise and it’s running fine now, thanks Fred! I
guess I paid the price for being a little too cocky after i set up the
first few controllers.

Cheers!
Lee

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs