RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

Rails 4: My First Run-in with Turbolinks

Stafford Brooke writes about his first run in with turbolinks in Rails 4.

Comments

Although the author's solution does solve the problem, a cleaner approach would be something like:


jQuery ->
$(document).on "click", "span.star", ->
... code dealing with ratings ...


This has the 2 added benefits. Firstly, it doesn't require you to nest all your handlers into a function that then needs to be called both on document ready and page:load. Secondly, you now only have 1 callback function created for the life of the session that handles the span.star click event.HuffMoody - May 07, 2013 20:23

Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!