Calling an action ''display'' is one of those unwritten things
that
doesn''t work. Rename it and you should be fine, perhaps
''show''.
- Gabriel
On 5/9/07, Chris Binckly
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Hi,
>
> I am trying to get the hang of rails. It has been going well, except
> now I am trying to add an action to a controller and am having trouble.
> I have a LinkCategory class which extends activerecord. In its
> controller, I added a method ''display'' which lists the
categories with
> its links. I then created a new view, display.rhtml.
>
> Wehn I navigate to localhost:3000/link_categories/display page, my view
> is rendered, but the display method in the controller does not seem to
> be exectued. At first, I was running a find across link categories in
> the controller and then attempting to use it in the view:
>
> <code>
>
> def display
> @link_categories = LinkCategory.find(:all)
> end
>
> </code>
>
> When the view is rendered, I am told that @link_categories is a nil
> object. I know that query returns a number of rows. I tried shorting
> the method to ensure that it was being executed by adding a:
> redirect_to :action => ''list''
> at the very beginning of the method, but the display view is still
> rendered. I was wondering if I had misconfigured something, or
> neglected to add a mapping, that was keeping the code in the controller
> from being executed. I still have the default routes configured. Any
> help would be appreciated.
>
> Thanks.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---