0

I have a Rails app that is using Turbolinks (v2.1.0), jquery-rails(4.2.1), bootstrap-sass (v3.2.0.0), and rails_script (v2.0.3) to arrange my Coffescript. Problem is that I cannot get my CoffeScript to execute unless I do a page re-load. My application.js file reads:

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require jquery-ui
//= require autocomplete-rails
//= require rails_script
//= require turbolinks
//= require_tree .

I read somewhere (JQuery gets loaded only on page refresh in Rails 4 application) that by requiring "jquery.turbolinks" before "turbolinks" it would execute as expected, but no luck.

My CoffeScript is the following:

class App.Rating extends App.Base

beforeAction: (action) =>
  return

afterAction: (action) =>
  return

index: =>
  alert 'in'
  #hide the new rating button if we are looking at specific ratings
  $('[id^=outer]').on 'show.bs.collapse', ->

    $('.new_rating').fadeOut 100
    return

The alert and code does not run unless I refresh the page. Any thoughts? Thanks!

Community
  • 1
  • 1
Gpcnec76
  • 69
  • 1
  • 8

0 Answers0