views:

121

answers:

1

In routes.rb I was forced to add:


post 'admin/user_update'

to get my form_tag to work:


form_tag( { :action => :update_user, :id => @user.id }, :remote => :true )

Now I get:


Template is missing

Missing template admin/update_user with {:handlers=>[:erb, :rjs, :builder,
:rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths
"/rails/test/app/views"

My template is update_user.js.erb:


$('#user-edit-<%= @user.id %>').html("&nbsp;");
$('#tr-user-edit-<%= @user.id %>').hide();

How can I get the route to accept that I want to process the request using js?

How can I add js to the :formats?

Please do not use the word "resources" in your reply. I'm aware this is a custom route.

A: 

If I'm understanding correctly, this is a jquery issue (though you never explicitly mentioned jquery)

Try adding:

$(document).ready(function() {
    $.ajaxSetup({ 
        'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
    });
});

to your application.js file.

Evan Cordell