Reputation: 13845
My form seems to work perfectly fine locally, but gives me a syntax error on heroku. Here is my code thats causing the error:
<%= form_for (@item, {:url => [@company, @item]}) do |item_form| %>
The error is:
syntax error, unexpected '}', expecting keyword_end 2011-09-24T22:25:25+00:00 app[web.1]: ...e, {:url => [@company, @item]}) do |item_form| @output_buf...
Then when I tried
<%= form_for (@item, :url => [@company, @item]) do |item_form| %>
It gave me this error:
syntax error, unexpected ',', expecting ')' 2011-09-24T22:18:01+00:00 app[web.1]: ...ffer.append= form_for (@share, :url => [@company, @share])
Any ideas?
Upvotes: 0
Views: 396
Reputation: 34072
You should remove the space between the method call form_for
and the opening parenthesis (
. As a general rule, never do this. It's ambiguous and may result in the parser thinking that you're calling form_for
with one argument, like this:
<%= form_for((@item, :url => [@company, @item])) do |item_form| %>
... which would be a syntax error, resulting in the errors you're seeing (e.g. unexpected comma)
# it should be:
<%= form_for(@item, :url => [@company, @item]) do |item_form| %>
# or, remove the parentheses altogether (up to your usage tastes):
<%= form_for @item, :url => [@company, @item] do |item_form| %>
Upvotes: 4