Reputation: 67
I have a rails app that I need to use Ajax to post on my model.
I have only this line in my filename.js.erb
$('#new-band a').html('<%= j render 'form'%>')
Here is my error:
Showing /<snip>/ajax/app/views/layouts/application.html.erb where line #8 raised:
undefined method `render' for #<#<Class:0x00007fad63eb3b98>:0x00007fad5e2c13f8>
Upvotes: 0
Views: 49
Reputation: 2398
You can try this:
$('#new-band a').html("<%= j render(:partial => 'form') %>");
Upvotes: 0
Reputation: 528
Try changing your single quote to double quotes around the form. For example:
$('#new-band a').html('<%= j render 'form'%>')
Changes to:
$('#new-band a').html('<%= j render "form" %>')
Upvotes: 1