title: Rails if else in view
body: <p>My comment controller needs adjust for nesting but I'm getting a few errors. Here's what I've been trying:</p>
  
  <pre><code>&lt;% if @commentable == @user %&gt;
    &lt;%= semantic_form_for [@commentable, @comment] do |f| %&gt;
  &lt;% else %&gt;
    &lt;%= semantic_form_for [@user, @commentable, @comment] do |f| %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Which gives this:</p>
  
  <pre><code>/Users/rbirnie/rails/GoodTeacher/app/views/comments/_form.html.erb:3: syntax error, unexpected keyword_else, expecting keyword_end'); else 
  </code></pre>
  
  <p>Any idea why this isn't working? Seems simple enough...</p>
  
  <p>Here's the full view:</p>
  
  <pre><code>&lt;% if @commentable == @user %&gt;
    &lt;%= semantic_form_for [@commentable, @comment] do |f| %&gt;
  &lt;% else %&gt;
    &lt;%= semantic_form_for [@user, @commentable, @comment] do |f| %&gt;
  &lt;% end %&gt;
  
    &lt;div class="control-group"&gt;
      &lt;%= f.label :subject %&gt;
      &lt;div class="controls"&gt;&lt;%= f.text_field :subject %&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="control-group"&gt;
      &lt;%= f.label :body %&gt;
      &lt;div class="controls"&gt;&lt;%= f.text_area :body, rows: 8 %&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="form-actions"&gt;
      &lt;%= f.submit "Submit", :class =&gt; "btn-success" %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>