How to render partial.js in rails 3

Posted by julian-mann on Stack Overflow See other posts from Stack Overflow or by julian-mann
Published on 2010-05-02T22:54:36Z Indexed on 2010/05/02 22:57 UTC
Read the original article Hit count: 420

Using rails3 - I have a project with many tasks. I want to use javascript to build the UI for each task. I figured I could display those tasks on the projects show page by rendering a javascript partial for each. I can't get 'tasks/show' to see tasks/show.js.erb Any ideas?

In projects/show.html.erb

<div id="tasks">
<%= render(:partial => "tasks/show", :collection => @project.tasks) %> 
</div>

tasks/show.js.erb

$("tasks").append(new TaskWidget(task.id))

I get the errors

ActionView::MissingTemplate in Projects#show 

Missing partial tasks/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths .... around line #13

Thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails3

Related posts about partial