Can I make a route that does not map to a URL in Ruby on Rails? -
i have bunch of routes in routes.rb this:
post 'events/form1'=> 'events#form1', :as => 'events_form1' post 'events/form2'=> 'events#form2', :as => 'events_form2' post 'events/form3'=> 'events#form3', :as => 'events_form3'
these controller actions process data forms. user never going need access these actions url wanted this:
post 'events#form1'
and then, in form, write
<%= simple_form_for :something, :url => url_for{:controller => 'events', :action => 'form1'}, :method => "post" |f| %>
this doesn't work because rails complains route invalid. possible have route without url? if not, how can clean routes file?
the simple_form_for
call still needs url, if users never use directly.
you can kind of see in code itself, in 1 of options you're sending simple_form_for
option url use:
:url => url_for{:controller => 'events', :action => 'form1'}
Comments
Post a Comment