当我在本地运行应用程序时,一切正常。我在应用中只有3个javascript文件:
app / assets / javascripts / application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .
app / assets / javascripts / social_posts.js
//= require moment/moment
时刻位于
vendor/assets/javascripts
。app / assets / javascripts / social_posts_actions.js.coffee
console.log 'hello'
# Format post dates
format_post_dates = ->
$('time.moment').each ->
dt = moment($(this).attr('datetime'))
dtstr = dt.format('h:mm A')
if dt.dayOfYear() != moment().dayOfYear()
dtstr = dt.format('MMM Do, ') + dtstr
$(this).html dtstr
return
return
add_edit_click_listener = ->
$('.edit-social-post-action').click ->
$('#socialPostMessage').val $(this).data 'message'
$('#socialPostImageUrl').val $(this).data 'image-url'
$('#myModal').modal()
return
return
# Add Handlers for the edit action
$(document).ready ->
console.log 'hello doc.ready'
add_edit_click_listener()
return
当我在heroku上查看源代码时,它显示了我的注释和
console.log
调用正在javascript源中进行更新,但没有执行任何操作。此外,如果我尝试从控制台调用moment()(包括的库之一),则该功能不可用。
在尝试使用heroku之前,我曾尝试在本地预编译我的资产,但这并不能解决问题。
这是铁轨4
最佳答案
找出解决方案。显然是因为我不包含系绳,所以引导程序就崩溃了。很烦人:(