On Ruby on Rails, <%= or <% should only matter whether it is show or no show, but why will it give
- by Jian Lin
The following code:
<div id="vote_form">
<%= form_remote_tag :url => story_votes_path(@story) do %>
<%= submit_tag 'shove it' %>
<% end %>
</div>
gives compilation error
while if the first <%= is replaced with <%, then everything works. I thought they only differ by "show" or "not show", but why will it actually cause a compile error?
The error is:
> SyntaxError in Stories#show
>
> Showing
> app/views/stories/show.html.erb where
> line #17 raised:
>
> compile error C:/Software
> Projects/ror/shov12/app/views/stories/show.html.erb:17:
> syntax error, unexpected ')' ...
> story_votes_path(@story) do ).to_s);
> @output_buffer.concat ...
> ^ C:/Software
> Projects/ror/shov12/app/views/stories/show.html.erb:23:
> syntax error, unexpected kENSURE,
> expecting ')' C:/Software
> Projects/ror/shov12/app/views/stories/show.html.erb:25:
> syntax error, unexpected kEND,
> expecting ')'