I have the following link_to:
<%= link_to 'user_' + user.id.to_s, {:controller => 'admin', :action => 'view_user', :id => user.id}, :remote => true %>
However, when I click that link, I get the following error:
ActionView::MissingTemplate at /admin/view_user
Missing template admin/view_user, application/view_user with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :haml, :rabl]}.
Searched in: /Users/me/Documents/production/my_app/app/views
It should be looking for view_user.js.erb. That file definitely exists.
This issue seems to have come up after I changed how I deal with jquery & 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?)
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.
here's what view_user looks like:
def view_user
respond_to do |format|
format.js
end
@user = User.find(params[:id])
user_show_helper
end
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).
Here's what view_user.js.erb looks like:
$("#user_under_review").html("<%= escape_javascript render(:partial => 'admin/view_user' ) %>");
And here's what the partial _view_user.html.erb looks like:
<%= render 'users/user_brief' %>
<div class="table_td_middle" id="<%= 'user_number_' + @user.id.to_s %>">
<%= link_to 'Approve user?', approve_user_as_admin_path(@user.id), :remote => true, :confirm => 'Are you sure you want to approve this user?' %>
</div>