0

When I run the app locally, everything works fine. I only have 3 javascript files in the app:

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 

moment is located at 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

When I view the source on heroku it shows my comments and console.log calls being updated in the javascript source but nothing is being executed.

Additionally, if I try calling moment() (one of the included libraries) from the console, the function isn't available.

I've tried pre-compiling my assets locally before pushing to heroku and that's not solving the problem.

This is rails 4

2
  • 1
    social_posts.js is in vendor folder? and moment is a function inside social_posts.js ? im correct? Commented Jan 31, 2016 at 6:42
  • @Marv-C no ... social_posts.js is under assets/javascripts, moment/moment is in the vendors/assets/javascripts folder Commented Jan 31, 2016 at 7:00

2 Answers 2

1

Figured out the solution. Apparently because I didn't include tether, bootstrap was crapping out. Quite annoying :(

Sign up to request clarification or add additional context in comments.

Comments

0

Have you run rake assets:precompile RAILS_ENV=production before you run git push heroku master? You need to compile your asset pipeline (images, css and js files) before pushing, otherwise they don't get uploaded to the production app.

1 Comment

I said in the original question that I precompiled it locally before pushing to test it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.