Trivial syntax error: Unexpected ')'

I am a Rails newbie but have programmed other languages/frameworks

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:

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:

          <select id="cboCategory" name="recipe[category_id]">
            <%= @categories.each do |category| %>
            <option value="" <%= 'selected' if
@recipe.category_id == %> >
              <%= %>
            <% end %>

I don't see anything wrong with that. However, I get an error as

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.

Good lord! I can be so careless. Thanks a lot, Thorsten Muller. This
is the second time I made this mistake. I'll be more careful for
myself in the future.


Just one other thing.

The 'textarea' I have for displaying instructions inserts many leading
and trailing spaces around the actual values. I checked and the
database records also have the leading and trailing spaces.

However, when I choose to edit a record and trim the trailing and
leading spaces around the instructions and issue an update, the spaces
are not trimmed. The next time I edit the record, they still appear.

Can you help me with this?