I know that I'm missing something very simple but I setup my
application to use for the links a remote=> true call. In the call it
finds the js.erb file, but doesn't render into the browser the
content.
LOG:
Started GET "/" for 127.0.0.1 at 2010-06-28 14:26:22 -0700
Processing by HomeController#index as JS
Rendered home/index.js.erb (0.3ms)
Completed 200 OK in 12ms (Views: 11.6ms | ActiveRecord: 0.0ms)
Started GET "/" for 127.0.0.1 at 2010-06-28 14:26:25 -0700
Processing by HomeController#index as HTML
Rendered home/index.html.erb within layouts/application (2.0ms)
Completed 200 OK in 6ms (Views: 5.6ms | ActiveRecord: 0.0ms)
As you can see in the html.erb it says within the layouts/application
But with the JS call it is missing -
my template looks like this -
<li><%= link_to 'index', :root, :remote=> true %></li> //This one
doesn't render in the template
<li><a href="/" >Home</a></li> // This one works
What am I doing wrong?
The jQuery data-remote tag looks like this -
$('a[data-remote],input[data-remote]').live('click', function (e)
{
$(this).callRemote();
e.preventDefault();
});
$('a[data-method]:not([data-remote])').live('click', function (e){
var link = $(this),
href = link.attr('href'),
method = link.attr('data-method'),
form = $('<form method="post" action="'+href+'"></form>'),
metadata_input = '<input name="_method" value="'+method+'"
type="hidden" />';
if (csrf_param != null && csrf_token != null) {
metadata_input += '<input name="'+csrf_param+'"
value="'+csrf_token+'" type="hidden" />';
}
form.hide()
.append(metadata_input)
.appendTo('body');
e.preventDefault();
form.submit();
});
Is it missing something?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.