Reputation: 6269
In my adminpage#index
controller i have defined @software
:
if Software.first != nil
@software = Software.first
else
@software = Software.new
end
Then in my form i have:
<% form_for(@software), :url => adminpage_setting_path do |f| %>
<%= f.label 'Name der zugelassenen Software' %>
<%= f.text_field :software %><br>
<%= f.label 'Software-Relase' %>
<%= f.text_field :release %><br>
<%= f.label 'Softwareverantwortlicher' %>
<%= f.text_field :sv %><br>
<% end %>
Somehow this invokes an error:
syntax error, unexpected ',', expecting keyword_end
'; form_for(@software), :url => adminpage_setting_pa...
^
I really have no clue what i made wrong! Thanks
Upvotes: 0
Views: 34
Reputation: 2100
Replace:
<% form_for(@software), :url => adminpage_setting_path do |f| %>
With:
<%= form_for @software, :url => adminpage_setting_path do |f| %>
EDIT:
Mini explanation as per requested by: Helios de Guerra
Upvotes: 1
Reputation: 25049
the :url => adminpage_setting_path
is actually the second parameter to the form_for
method.
It should be form_for(@software, :url => adminpage_setting_path) do |f|
.
Upvotes: 2