Hi, i'm starting now with rails, and i have simply question.
I need to render two partials in one ajax call:
I have the following controller:
# GET /hosts/1
# GET /hosts/1.json
def show
@host = Host.find(params[:id])
respond_to do |format|
format.html #show.html
format.js
format.json { render :json => @host }
end
end
And the respective template (show.js.erb):
$('#tabs-1').html("<%= escape_javascript(render @host) %>");
And a partial file named _host.html.erb
All this works fine, but now i need to add some other partial template
in a different id (#tabs-2), but use the same @host
How can i do this? de default render @host will use the template file
_host.html.erb. How can i call a different one like _host2.html.erb and
have the same @host instance?
Thanks
Joao
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.