In my Rails app I'm passing a variable to this call: $.get("/parent_submissions/", {submission: d.id}, null, "script");, and I'd like the submission variable to pass through to the partial that is loaded through the controller. The controller action that is routed through /parent_submissions/ is:
def parent
@submission = Submission.find(params[:submission])
end
That action loads parent.js.erb, which looks like this:
$("body").append( "<%=j render :partial => 'parent', :locals => {:submission => @submission } %>" );
And _parent.html.erb simply looks like this:
<h1>@submission.title</h1>
I checked in my console to see what happens when the get request is called, and it looks like this:
Processing by SubmissionsController#parent as JS
Parameters: {"submission"=>"190", "_"=>"1378443591336"}
This means that the submission value is not null, and is passing the correct submission id through the request correctly. But when the partial is rendered, it just looks like @submission.title.
I assume something is wrong in the controller. Any ideas?
<%= @submission.title %>.