Ruby on rails 在application.js.coffee中未调用该脚本

Ruby on rails 在application.js.coffee中未调用该脚本,ruby-on-rails,coffeescript,Ruby On Rails,Coffeescript,我认为: .form-actions %p= attach_links = f.button :submit, 'Add post', class: 'btn-bg' - if paid? = f.button :submit, 'save in ...', class: 'btn-inverse', name: 'draft' = button_tag 'Add poll', type: 'button', id: 'poll-btn', class

我认为:

.form-actions
    %p= attach_links
    = f.button :submit, 'Add post', class: 'btn-bg'
    - if paid?
      = f.button :submit, 'save in ...', class: 'btn-inverse', name: 'draft'
    = button_tag 'Add poll', type: 'button', id: 'poll-btn', class: 'btn btn-bg'
    = link_to 'Cancel', blog_posts_path
单击按钮时,标签“添加投票”将显示新投票的表格

我的脚本位于app/assets/javascript/application.js.coffee中,用于显示表单新投票:

$(document).ready ->
  $('#poll-btn').click ->
      if $('.poll').is(':visible')
        $('.poll').hide()
        $('#poll-btn').text 'Add poll'
        event.preventDefault()
      else
        $('.poll').show()
        $('#poll-btn').text 'Delete Poll'
        event.preventDefault()
      return
  return
GEMFILE

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'compass-rails'
  gem 'bootstrap-sass', '2.1.1.0'
  gem 'therubyracer'
  gem 'execjs'
  gem 'uglifier', '>= 1.0.3'
  gem 'oily_png'
  # gem 'font-awesome-rails'
  gem 'turbo-sprockets-rails3'
end
我点击按钮,但不调用我的脚本。我无法理解为什么。你能帮我解决这个问题吗?多谢各位

编辑

application.js.coffee的一部分

$(document).on 'click', '@load_more_comments', (e) ->
  e.preventDefault()
  $(this).html("<i class='icon icon-spin icon-refresh'></i> загрузка...")
  u = $(this).parent().find('@comments_list').data('u')
  l = $(this).parent().find('@comments_list').data('lastcid')
  $.ajax
    url: u
    dataType: 'script'
    method: 'GET'
    data:
      loadnew: l

$(document).ready ->
  $('#poll-btn').click ->
      if $('.poll').is(':visible')
        $('.poll').hide()
        $('#poll-btn').text 'Add poll'
        event.preventDefault()
      else
        $('.poll').show()
        $('#poll-btn').text 'Delete poll'
        event.preventDefault()
      return
  return


show_photo = (u) ->
  if window.innerWidth > 780
    $.fancybox.showLoading()
    $.ajax
      url: u
      method: 'GET'
      dataType: 'script'
      data:
        w: window.innerWidth
        h: window.innerHeight
  else
    document.location = u
$(文档)。单击“@load\u more\u comments”,(e)->
e、 预防默认值()
$(this.html(“ззззззззззззз1079
u=$(this.parent().find('@comments\u list').data('u'))
l=$(this.parent().find('@comments\u list').data('lastcid'))
$.ajax
网址:u
数据类型:“脚本”
方法:“获取”
数据:
新地址:l
$(文档).ready->
$(“#轮询btn”)。单击->
如果$('.poll')。是(':visible')
$('.poll').hide()
$(“#轮询btn”)。文本“添加轮询”
event.preventDefault()
其他的
$('.poll').show()
$(“#轮询btn”)。文本“删除轮询”
event.preventDefault()
返回
返回
显示照片=(u)->
如果window.innerWidth>780
$.fancybox.showLoading()
$.ajax
网址:u
方法:“获取”
数据类型:“脚本”
数据:
w:窗宽
h:窗高
其他的
document.location=u

你的app/assets/javascript/application.js文件中包含哪些内容?包含所有代码,大约3000行以及所有#=需要的内容。。。今天我以生产模式运行服务器。但现在又用rails s运行了,为什么不工作呢,我不能确定资产是否有问题?