Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails not rendering a partial

I can't get my page to render a partial. When I pull run it on the server it does not render the partial at all, but just skips it. No error messages.

# edit.html.erb    
<%= link_to("<< Back to List", {:action => 'list'}, :class => 'back=link')%>

<div class="subject edit">
    <h2>Edit Subject</h2>
    
    <%= form_for(:subject, :url => {:action => 'update', :id=>@subject.id}) do |f| %>
    
        <% render :partial => 'form', :locals => {:f => f} %>
    
        <div class="form-buttons">
            <%= submit_tag("Update Subject")%>
        </div>
    
    <% end %>
</div>

and this is _form.html.erb

<table summary="Subject form fields">
    <tr>
        <th>Name</th>
        <td><%= f.text_field(:name) %></td>
    </tr>
    <tr>
        <th>Position</th>
        <td><%= f.text_field(:position) %></td>
    </tr>
    <tr>
        <th>Visible</th>
        <td><%= f.text_field(:visible) %></td>
    </tr>
</table>
like image 966
James Lin Avatar asked Oct 28 '11 22:10

James Lin


1 Answers

You need the = sign:

<%= render :partial => 'form', :locals => {:f => f} %>

(you had <% render ....)

like image 104
robotcookies Avatar answered Oct 07 '22 20:10

robotcookies