Url_for and :defaults

Hello,

in my routes there are (just for testing):

map.connect ‘:controller/:id/:action’, :defaults => {:action => ‘alma’}

in my controller:

    def alma
            render :text => url_for(:id => 123)
    end

so I go to:

http://localhost:3000/music/store

which generates:

http://localhost:3000/music/store/123/index

Where the action is not correct, it should be “alma” instead of “index”

What do I wrong?

      Mage

Excuse me, I have to correct myself.

This thing only happen if I define the :controller to.

So the real code pieces look like:

render :text => url_for(:controller: ‘store’, :id => 123)

Where store is the actual controller.

Should I send a bug report?

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