I have a form to create vehicals and define the route corresponding to it, But it consistently gives a typo error, I think I am doing it wrong, please correct following is the code:
<%= form_for @vehical, url_for(:action => :create, :controller => 'vehicals') do |vehical| %>
<div>
<%= vehical.label 'house power'%>
<%= vehical.text_field 'horse_power'%>
</div>
<div>
<%= vehical.label 'brand' %>
<%= vehical.text_field 'brand' %>
</div>
<div>
<%= vehical.label 'model' %>
<%= vehical.text_field 'model' %>
</div>
<%= vehical.submit 'create' %>
<% end %>
routes for it:
match '/vehicals/create', :to => 'vehicals#create', :as => 'vehicals_create', :via => :post
Error:
ActionView::Template::Error (no implicit conversion of Symbol into Integer):
1:
2: <%= form_for @vehical, url_for(:action => :create, :controller => 'vehicals') do |vehical| %>
3: <div>
4: <%= vehical.label 'house power'%>
5: <%= vehical.text_field 'horse_power'%>
thanks in advance
Aucun commentaire:
Enregistrer un commentaire