Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

render :partial with html.erb in controllers

#355

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?

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

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to invalid
    • Tag set to 2.0-stable, actionpack, controller

    July 23rd, 2008 @ 04:35 PM