Answer the question
In order to leave comments, you need to log in
Am I creating custom routes correctly?
In general, there are many lines of this kind:
get 'home/section1'
get 'home/section2'
Answer the question
In order to leave comments, you need to log in
It is possible like this:
%w(section1 section2).each do |action_name|
get "/home/#{action_name}"
end
If you have "section1" ... "sectionN" functions in your controller, then yes.
I personally prefer to write it like this:get 'home/section1' => 'home#FuncName'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question