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

  • SEARCH
  • Home
  • 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 6079027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:54:01+00:00 2026-05-23T10:54:01+00:00

show.html.erb: … <%= link_to Start Retrieval, {:action => retrieve}, :remote => true %> <div

  • 0

show.html.erb:

...
<%= link_to "Start Retrieval", {:action => "retrieve"}, :remote => true %>
<div id="notices">
       <%= render :partial => 'notice' %>  
</div>
....

_notice.html.erb:

<div>Notice</div>

retrieve.js.erb:

#alert('test') //=> does not work
$('#notices').append("<% escape_javascript render :partial => 'notice' %>");

controller:

def retrieve
    respond_to do |f|
       #f.js {render :js => "alert(typeof jQuery != 'undefined')"} #=> true
       f.js {render :js => "retrieve"} #=> nothing happens
    end
end

Output:

Started GET "/model/1/retrieve" for 127.0.0.1 at 2011-06-24 21:09:44 +0100
  Processing by ModelController#retrieve as JS
  Parameters: {"id"=>"1"}
Completed 200 OK in 50ms (Views: 49.2ms | ActiveRecord: 0.0ms)

As you can see the retrieve verb doesn’t involve the model directly and I’m not passing a @model var to the templates. I’m under the impression this is just shorthand and should not affect things. Am I wrong about this?

  • 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-05-23T10:54:01+00:00Added an answer on May 23, 2026 at 10:54 am

    You should be able to just do:

    respond_to do |f|
      f.js {}
    end
    

    Which will render the js.erb file with the same name as the action (retrieve.js.erb).

    What you’re doing is rendering the string “retrieve” as pure javascript, equivalent to having just “retrieve” in the js file, like this:

    &ltjavascript>
    retrieve
    &lt/javascript>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Projects habtm Tasks On tasks/show.html.erb I have link_to Add This Task To Project, new_project_path(:task
(Warning: Clueless Rails Newbie!) In my show.html.erb for my albums view, I call a
When I generate a default scaffold, the display tags on show.html.erb have <%=h @broker.name
I've a HTML page with several Div's that will show the time difference between
I'm trying to add some jQuery + ERB to a specific view: views/posts/show.html.erb (top
I have a partial: 'profiles/_show.html.erb' that contains code like <%= @profile.fullname %> I'm trying
I've pastied the specs I've written for the posts/show.html.erb view in an application I'm
I have a partial, _approve.html.erb in my views/users directory that I would like to
I'm having trouble getting a for to submit from my show.html.erb page. It is
This is the error: ActionView::Template::Error (No route matches {:action=>send_to_client, :controller=>stages}): app/views/stages/_show.html.erb:13:in `_app_views_stages__show_html_erb__3606907191157577988_2203521120_617355097038007272' app/controllers/stages_controller.rb:78:in `block

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.