Reputation: 441
I've been having some trouble with my form in my ruby and rails application. I am using the slim template engine to create the layouts. here is my form code
= form_tag(:action => '/project/new', :method => "post", class: 'form-horizontal') do
#####
A bunch of input fields
#######
button.btn.btn-large.btn-primary.btn-block.disabled#go type="submit" Go!
span.help-inline * required fields
When i click on the submit button nothing happens. No call is made to the action in my controller. Here is my controller code:
def new
puts "HERE"
redirect_to :action "show" , id: 87
end
The 'HERE' never gets printed to my terminal. What is wrong with the way I am setting up my form? Thanks in advance
Upvotes: 0
Views: 1899
Reputation: 53018
Replace
= form_tag(:action => '/project/new', :method => "post", class: 'form-horizontal') do
with
= form_tag({:controller => 'project', :action => 'new'}, :method => "post", class: 'form-horizontal') do
form_tag
accepts 2 arguments: the path for the action and an options hash. You need to tell Ruby which is which by delimiting the first hash (or both) with curly brackets.
Upvotes: 2