Comments in RHTML files

Hello all,

I have a Partial and at the beginning of it I have Ruby code (<% ...
%>) in which a have a couple of comments. When the comments (which
starts with #) are in the Partial, my partial is not displayed, when I
remove them my Partial works. Why?

Here is the beginning of the partial :

<%

  # Check if we passed to the partial the User object
  user = User.find_by_id(session[:userId]) if
local_assigns[:user].nil?

%>

<div id="myPartial">

<% form_id = "myPartial_form";
...

I believe the problem is that the <%# sequence is leading ERb to
interpret the entire block as a comment, not simply the one line that
you intend as a comment.

More broadly speaking, it's a bad idea to be doing ActiveRecord finds
in your views. They should only be fed data (via locals or instance
variables) and render. You might consider using a before_filter that
creates a @current_user (for all controllers) by reading in from the
users table and then simply testing for @current_user.nil?