ruby on rails - How to send form data to #index with post instead of #create? -


i have resource route setup:

resources :events 

for 1 form, i'd send data #index action :post method. how can this?

i tried <%= form_tag url_for(controller: 'events', action: 'index'), method: :post, still goes #create

short answer: can't routes.

long answer: when using resources :events following routes defined you:

get     /events     events#index     /events/new     events#new post    /events     events#create      /events/:id     events#show     /events/:id/edit    events#edit patch/put   /events/:id     events#update    delete  /events/:id     events#destroy 

therefore index action isn't accessible post request.

and trying (with f.e. custom routes resources :events) make create action on post inaccessible.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -