How to direct to an action in current controller

Hi all,

I want to create a link in a view which directs me to an action in the
same controller. But the URL shouldn’t change. Does anyone know an easy
way how to implement that?
If I write something like this : <%= link_to “Hello”, { :controller =>
"current_controller”}, :action => “myAction”} %>
then I need to define an rhtml file like myAction.html. But I don’t want
that. I just want that the action ‘myAction’ in current_controller is
called…

Cheers,
yussibaer

You don’t have to have a myAction.rhtml file, you can always say
render :action => ‘some_other_action’ to render that rhtml file, or even
render :nothing => true to render nothing at all

Fred

If you don’t want to have separate myAction.rhtml file, just add line:
render ‘default’

in the end of your myAction code in controller
It will render file default.rhtml

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs