I want to create parameter in routes.rb which is wanted to be used in
javascript code in view page. there is select object in my view page and
this parameter will get value from select object however that my select
object is not in form.
how can I create parameter in routes.rb and equals to option value.
do you have any idea how to do it?
I have a sample code of my friend but I didnt understand it well
%w( optimize report sheet ).each do |controller|
map.connect
“:enterprise_code/:m_hierarchy_id/:t_project_id/#{controller}/:action/:id”,
:controller => “project/#{controller}”,
:requirements => { :m_hierarchy_id => /\d+/, :t_project_id =>
/\d+/ }
end
in routes.rb
Actually I could nt understand the logic of parameters in routes.
my question was quite silly I think.
There will be 3 controllers name, you will run, optimize, report, sheet.
%w( optimize report sheet ).each do |controller|
map.connect
“:enterprise_code/:m_hierarchy_id/:t_project_id/#{controller}/:action/:id”
example your enterprise_code params in /project/optimize is ‘Voo_doo’,
and :t_project_id is ‘1’,:m_hierarchy_id is ‘2’, :action is ‘testing’,
:id is ‘5’
specifies that the given components, if present in the URL, must each
match the specified ‘regular expressions’ in order for the map as a
whole to match. In other words, if any component does not match this map
will not be used.
:action is where your def method in your controller you want to use