Note that there are some explanatory texts on larger screens.

plurals
  1. POController is looking for HTML format instead of JS format (though we set :remote => true)
    primarykey
    data
    text
    <p>I have the following link_to:</p> <pre><code>&lt;%= link_to 'user_' + user.id.to_s, {:controller =&gt; 'admin', :action =&gt; 'view_user', :id =&gt; user.id}, :remote =&gt; true %&gt; </code></pre> <p>However, when I click that link, I get the following error:</p> <pre><code>ActionView::MissingTemplate at /admin/view_user Missing template admin/view_user, application/view_user with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :coffee, :haml, :rabl]}. Searched in: /Users/me/Documents/production/my_app/app/views </code></pre> <p>It should be looking for view_user.js.erb. That file definitely exists.</p> <p>This issue seems to have come up after I changed how I deal with jquery &amp; jquery-ui. I am now using the jquery-ui-rails gem. I removed the lines requiring jquery-ui and jquery_ujs from my application.js file. I don't know of anyway to add jquery_ujs (maybe it is packaged with rails?)</p> <p>Any clue what might be going on? What's puzzling is, I figured explicitly saying :remote => true would result in the JS file being rendered.</p> <p>here's what view_user looks like:</p> <pre><code>def view_user respond_to do |format| format.js end @user = User.find(params[:id]) user_show_helper end </code></pre> <p>user_show_helper is a huge method that basically sets a bunch of instance variables necessary to show the snippet of a user profile (i.e. there is no render method called in user_show_helper).</p> <p>Here's what view_user.js.erb looks like:</p> <pre><code>$("#user_under_review").html("&lt;%= escape_javascript render(:partial =&gt; 'admin/view_user' ) %&gt;"); </code></pre> <p>And here's what the partial _view_user.html.erb looks like:</p> <pre><code>&lt;%= render 'users/user_brief' %&gt; &lt;div class="table_td_middle" id="&lt;%= 'user_number_' + @user.id.to_s %&gt;"&gt; &lt;%= link_to 'Approve user?', approve_user_as_admin_path(@user.id), :remote =&gt; true, :confirm =&gt; 'Are you sure you want to approve this user?' %&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload