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?
On Feb 16, 5:07 pm, Martin
<martinga...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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";
> ...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---