Forum: Ruby on Rails newbie wanting to understand controller action relationship

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bd3a9ca8a116e0055e65dd2d6069c946?d=identicon&s=25 Todd S. (tdog)
on 2006-02-19 20:26
I still getting my feet wet with rails and I'm trying to learn some good
ways of working with link_to_remote.

I'm using the user and login engines and I have in my layout this...
 link_to_remote( 'Login', :update => 'main-query',
                                      :url =>{:action => 'login'},
                                      :complete =>
"javascript:toggle('main-query');
                                      new Effect.SlideDown('main-query',
{duration: .5})")

which is used to slide open a login window.  It works well, however
depending on the page I have loaded I will sometimes get a NoMethod
Error when the link is clicked.

Do I need to add a :controller => 'user' to the :url line somehow?  (If
so, I'm doing it wrong because that dosn't work either).  How does rails
interpret this?
De4bc2ea0dbe8d1ef6c3e190325a35de?d=identicon&s=25 Anton Kovalyov (Guest)
on 2006-02-19 20:55
(Received via mailing list)
> Do I need to add a :controller => 'user' to the :url line somehow?  (If
> so, I'm doing it wrong because that dosn't work either).  How does rails
> interpret this?

Hello. If no controller specified Rails thinks that it should use
current controller. So, you have to specify your controller to access
it from any other place.
Bd3a9ca8a116e0055e65dd2d6069c946?d=identicon&s=25 Todd S. (tdog)
on 2006-02-19 22:16
This is what I thought, however when I specify to use the 'user'
controller I get an error.
Bd3a9ca8a116e0055e65dd2d6069c946?d=identicon&s=25 Todd S. (tdog)
on 2006-02-19 22:34
In fact,  If I specify the controller to be "application" I will be
directed to the login page. And if I navigate to
localhost:3000/user/login I am shown the login page, however when I
generate a link with :controller set to 'user' I only get a
NoMethodError return.
This topic is locked and can not be replied to.