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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Dave, Dave Evans wrote:> > I have a simple controller named AssociationsController. > Here is a snip: > > AssociationsController< ApplicationControllerIs your model, by any chance, names ''associations''? If so, that''s probably where your problem starts. hth, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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? On 7/28/07, Bill Walton <bill.walton-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> > 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 > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On 7/29/07, Bill Walton <bill.walton-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> > 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 > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---