Search code examples
jqueryruby-on-railsherokutwitter-bootstrapprecompile

Bootstrap popover not working on heroku


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.


Solution

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