Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define action with simple form for?

I am trying to define the action "savenew" in admin/photographers controller.

I have tried this:

<%= simple_form_for(:photographer_savenew, :action => 'savenew', :id  => params[:id],  :multipart => true ) do |f| %> 

But the action in the form is still: /admin/photographers

When it should be: /admin/photographers/savenew

like image 284
Rails beginner Avatar asked Sep 21 '11 22:09

Rails beginner


People also ask

What is simple form for?

1. The simplest form is the smallest possible equivalent fraction of the number.


1 Answers

Is there a reason you're not using REST for this? It would make your life a lot easier and requires much less code. If you're set on using this custom action, you will need to specify the url and probably the method:

<%= simple_form_for @photographer, :url => savenew_photographers_path, :method => :post ... # etc 
like image 141
Peter Brown Avatar answered Sep 23 '22 12:09

Peter Brown