NoMethodError - previously defined method?

Hello,

I have a simple controller named AssociationsController. Here is a snip:

AssociationsController< ApplicationController

def detail
@association = Association.find(params[:id])
render layout: => “frontend”
end

def display
@association = Association.find(params[:id])
render layout: => “frontend”
end

def displaydetail
@association = Association.find(params[:id])
render layout: => “frontend”
end

end

When called using standard routing:
http://www.test.com/apps/public/associations/display/3
http://www.test.com/apps/public/associations/detail/3
http://www.test.com/apps/public/associations/displaydetail/3

Only the displaydetail method works, the others give:
NoMethodError in Associations#display
NoMethodError in Associations#detail

There are three identical rhtml files, each named for the method, as
they should be.

Is this some sort of issue with display and detail already being
defined elsewhere?

Thanks for any help you can give.

Dave

Hi Dave,

Dave Evans wrote:

I have a simple controller named AssociationsController.
Here is a snip:

AssociationsController< ApplicationController

Is your model, by any chance, names ‘associations’? If so, that’s
probably
where your problem starts.

hth,
Bill

Nope, my model is named Association:

class Association < ActiveRecord::Base

has_many :bulletins
file_column :photo, :magick => { :geometry => “300x200>” }

end

Why did you suspect that?

Hi Dave,

Dave Evans wrote:

Nope, my model is named Association:

Why did you suspect that?

Because Rails’ default behavior would lead one to expect
AssociationController, not AssociationsController. I could be wrong,
but I
think that unless you tell it otherwise, Rails is going to look for a
model
named ‘Associations’. Try explicitly telling Rails what model to look
for.

model :association

HTH,
Bill

That may be so. I used the generate script to generate scaffolding for
the application. It created both an AssociationController and an
AssociationsController.

If you have a look at the controller code I posted in my original
email, you’ll see that I am specifying the Association model in my
methods. The question is: Why do two methods that defined the same yet
named differently behave differently? display doesn’t work.
displaydetail does. That makes me think there is some previous
definition of the display method that is taking precedence.

Dave