Tuesday, August 10, 2010

[Rails] Re: Help on Route

Tony Yin wrote:
> Anubhaw Prakash wrote:

>> Try this,
>>
>> map.resources :controller_name, :collection => { :method_name => :get }
>>
>> Thanks,
>> Anubhaw
>
> hi Anubhaw, thanks for the reply, but that did not work. When I put that
> in
> my routes.rb, I lost home index; but I can view index from
> localhost:3000/site. But when I try to view localhost:3000/about it
> gives me an error message Unknown action
>
> No action responded to show. Actions: about, help, and index
>
> So it appears something is not connecting, even though I specified the
> action name and the action is defined in my controller.

Hi Tony,
Site is your controller name.
If you need to access a method from controller, the url should be like
this
'localhost:3000/site/about'.

When you hit 'localhost:3000/site' the actual url is
'localhost:3000/site/index'.
So in link to you need to specify controller name and action name.
If you need the url like localhost:3000/about, you need to specify
following in route:-
map.connect '/about', :controller => 'site', :action => 'about'.

Thanks,
Anubhaw
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate