Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8586053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:13:00+00:00 2026-06-11T22:13:00+00:00

Update: My question was answered, but I wrote a blog post detailing exactly how

  • 0

Update: My question was answered, but I wrote a blog post detailing exactly how I went about doing this: http://lathamcity.com/posts/ajaxInRails.html

I have a page that shows a list of things based on a Ruby object. My goal is to make an Ajax call to get a new Ruby object and then update the list based on that.

I thought that the way to do this was with partials. I make the entire list a partial file with the Rails instance variable in the code. Then I want the Ajax call to set the corresponding instance variable to the new list and re-render the partial.

That’s the end goal, but right now I’m trying to do a really basic version of that where I just set an instance variable to a string and then show the string.

So in my div, I have:

<% form_tag :action => :go , :method => :get, :remote => true  do %>
    <%= submit_tag "Go" %>
<% end %>

<div id="test"><%= render(:partial => 'test') %></div>

There’s a _test.erb file in the views/interface (the name of my controller) folder, with only the following line as its contents:

<%= @test %>

And then in my controller,

def go
    @test = "Hello You"
    render :update do |page|
        page.replace_html "test", :partial => "test"
    end
end

When I run this, I get: Missing template interface/update, application/update

I don’t know much about render :update, I found it in an example on Google.

What am I doing wrong that is causing this problem and how can I fix it? Am I going about this the right way or is there a better way to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:13:02+00:00Added an answer on June 11, 2026 at 10:13 pm

    I think both render :update and replace_html were deprecated/removed in rails 3.1. The standard way of doing partial updates is to use a js.erb template.

    In your controller, tell your action to respond to js request:

    @test = "Hello you"
    respond_to do |format|
        format.js
    end
    

    Create the js response template app/views/interface/go.js.erb:

    $('#test').html("<%= escape_javascript(render('test', test: @test})) %>")
    

    and change the partial code to <%= test %> because this is no longer an instance variable; rather, test is being passed to the partial as an argument from the js.erb template with test: @test

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE I answered my question below, but I am still asking for a prettier
UPDATE (spoiler): This question is answered (see David Carlisle answere below) and it looks
UPDATE: This question is out of date, but left for informational purposes. Original Question
Update: This question was an epic failure, but here's the working solution. It's based
Sorry for the double post, I will update this question if I can't get
* UPDATE: *I've already answered my question. But you can still give me advise
Original question has been answered. Update addresses related question raised in comments. Original post:
This question has been asked/answered (mostly) before, BUT I've tried three things to stop
Update: Ehh -- Even though this question isn't answered, I've just emptied my pockets
Update: Question Answered But, since I don't know how to 'delete' or 'void' a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.