Logo Questions Linux Laravel Mysql Ubuntu Git Menu

rails routing controller action change

I'm struggling here with a problem: I have a controller questions which has action new. Whenever I need to create new question, I'm typing


What changes to routes.rb should I make to change the URI to


Thank you. Valve.

like image 826
Valentin V Avatar asked Dec 18 '22 10:12

Valentin V

1 Answers

Try this:

map.ask_question   '/questions/ask', :controller => 'questions', :action => 'new'

Then you'll have a named route and you can:

link_to "Ask a question", ask_question_path
like image 118
Christian Lescuyer Avatar answered Jan 04 '23 15:01

Christian Lescuyer