Alex Rivera | Logout

Ruby inside CoffeeScript

Asked 2011-09-12T17:23:24.183
9

posts.js.coffee.erb

$('.list').infinitescroll {url: '<%= list_posts_path %>', triggerAt: 700, container: $('.container'), appendTo: $('.container'), page: 1}

This makes an exception:

throw Error("NameError: undefined local variable or method `list_posts_path' for #<#:0x00000003557438>\n ...

list_posts_path returns correct path if I use it in controller. What I do wrong?

Edit
Report

1 Answer

3

another alternative is to set a data attribute holding your path on some relevant element... then grab it with the js/coffee code

answered 2012-08-06T22:47:05.053

Your Answer