I am a Rails newbie but have programmed other languages/frameworks earlier.
There's a trivial syntax error I can't for the life of me figure out. I am following the well-known Ruby On InstantRails tutorial from here: http://instantrails.rubyforge.org/tutorial/index.html
I am overriding the default 'edit' method on the recipe controller. I get the error in the edit.rhtml while creating the drop down for displaying categories.
The relevant snippet is produced below:
<tr> <td>Category</td> <td> <select id="cboCategory" name="recipe[category_id]"> <%= @categories.each do |category| %> <option value="category.id" <%= 'selected' if @recipe.category_id == category.id %> > <%= category.name %> </option> <% end %> </select> </td> </tr>
I don't see anything wrong with that. However, I get an error as follows:
compile error ./script/../config/../app/views/recipe/edit.rhtml:37: syntax error, unexpected ')' _erbout.concat "\t\t\t\t\t\t"; _erbout.concat(( @categories.each do | category> ).to_s); _erbout.concat "\n"
^ ./script/../config/../app/views/recipe/edit.rhtml:87: syntax error, unexpected kEND, expecting ')'
I can gather it is complaining about some misplaced paranthesis and 'end' statement. However, there is no other enumeration/anonymous code block in the code other than the one shown above.
Help appreciated.