This project is archived and is in readonly mode.

#355 ✓invalid
Florian Dutey

render :partial with html.erb in controllers

Reported by Florian Dutey | June 6th, 2008 @ 09:56 AM

Hi. Got a strange bug with .html.erb when calling from my controllers

#Views

(in list.html.erb)

[...]

<table id="articles" cellpadding="0" cellspacing="0" class="crud">

  <%= render :partial => 'list' %>

</table>

[...]

(in _list.html.erb)

<thead>

  <tr>

    <th <%= th_class 'title'%>><%= sort_link 'Title', 'title', 'articles' %></th>

[...]

#Helper

(in application_helper.rb)

  [...]

def sort_link(text, params, update)

  [...]

  options = {

    :url => {:action => 'list', :params => params.merge({:sort => key, :page => nil})},

    :update => update,

    :before => "$('spinner').show();",

    :complete => "$('spinner').hide();"

  }

  [...]

  link_to_remote(text, options, html_options)

end

#Controllers

(in articles_controller.rb)

def list

  [...]

  respond_to do |format|

    format.html { render :action => 'list' }

    format.js { render :partial => 'list' }

  end

end

===============================================

when calling list as html (articles/list), no problem

when calling list as js, if partial => 'list' is '_list.rhtml', no problem, but if partial => 'list' is '_list.html.erb', got the following exception:

Couldn't find template file for admin/articles/_list in ["/home/mulasse/rails/cobalt_blog/app/views"]

(ActionView::ActionViewError).

Is that a normal behavior please?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages