0

Bootstrap's popover works perfectly on my local machine but doesn't seem to work on heroku. I can't figure out why. Here's the relevant files/code I can think of:

Bundler.require(*Rails.groups(:assets => %w(development test)))

I also tried lazy compiling with no luck (Bundler.require(:default, :assets, Rails.env))

and the popover view code:

%img.pop{:alt => "", :src => "#{photo.photo.url(:thumb)}", :rel => 'popover', :'data-placement' => 'bottom', :'data-content' => image_tag(photo.photo.url(:small))}

I have bootstrap-popover.js in my assets/javascripts folder. and here is my application.js file:

//= require jquery
//= require jquery_ujs
//= require_tree .
//= require bootstrap-popover
//= require bootstrap-alert
//= require bootstrap-dropdown


$(document).ready(function()
{
  $('.pop').popover();
  $('#hp_email_field').focus();

});

To be honest, I'm not even sure if precompiling is turned on right now. I think it is based on the first code line I posted here. any help is appreciated. everything works fine in local

EDIT: FYI - turning on lazy compile is the only way to get activeadmin working...not sure why...so i turned lazy compile back on

EDIT2: also, when I look at console and try $('.pop').popover(); it says there's no method for that..obviously it isn't loading properly.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Matthew Berman
  • 8,481
  • 10
  • 49
  • 98

2 Answers2

1

I had a similar issue. precompiling the assets, then checking them into git and deploying to heroku solved it for me.

davidrac
  • 10,723
  • 3
  • 39
  • 71
  • how do i go about doing that? – Matthew Berman Jul 02 '12 at 19:49
  • bundle exec rake assets:precompile see here: https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar – davidrac Jul 02 '12 at 19:56
  • tried this and it still didn't work...i have a javascript error (Uncaught TypeError: Cannot read property 'Constructor' of undefined) but i don't think this has anything to do with it. same error on local with no issues. – Matthew Berman Jul 02 '12 at 20:04
0

Also try enabling Heroku's user-env-compile labs feature: https://devcenter.heroku.com/articles/labs-user-env-compile

aren55555
  • 1,677
  • 1
  • 20
  • 34