{"action":"created","issue":{"url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails/issues/116","repository_url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails","labels_url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails/issues/116/comments","events_url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails/issues/116/events","html_url":"https://github.com/Nerian/bootstrap-datepicker-rails/issues/116","id":148881782,"number":116,"title":"Not loading properly on Ruby on Rails 4 production mode","user":{"login":"KarlHeitmann","id":3003032,"avatar_url":"https://avatars.githubusercontent.com/u/3003032?v=3","gravatar_id":"","url":"https://api.github.com/users/KarlHeitmann","html_url":"https://github.com/KarlHeitmann","followers_url":"https://api.github.com/users/KarlHeitmann/followers","following_url":"https://api.github.com/users/KarlHeitmann/following{/other_user}","gists_url":"https://api.github.com/users/KarlHeitmann/gists{/gist_id}","starred_url":"https://api.github.com/users/KarlHeitmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KarlHeitmann/subscriptions","organizations_url":"https://api.github.com/users/KarlHeitmann/orgs","repos_url":"https://api.github.com/users/KarlHeitmann/repos","events_url":"https://api.github.com/users/KarlHeitmann/events{/privacy}","received_events_url":"https://api.github.com/users/KarlHeitmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-16T19:24:16Z","updated_at":"2016-04-17T16:03:51Z","closed_at":null,"body":"I'm working on a Ruby on Rails 4.2.5 application, and I'm using gem 'bootstrap-datepicker-rails' 1.5.0\r\n\r\nWhen I'm working on my development server, on the local computer, I can click the text_field and the calendar pops up properly:\r\n\r\n> = f.text_field :fecha_raw_begin, class: \"puntero\", \"data-provide\" => \"datepicker\", \"data-date-format\" => \"dd/mm/yyyy\", \"data-date-autoclose\" => \"true\", \"data-date-language\" => \"es\"\r\n\r\n**Note:** My datepicker widget belongs to a form, I want to perform searches between a time span.\r\n\r\nBut whenever I switch to production mode, deploying on a remote server using Capistrano, I get problems: whenever I click the text_field, the datepicker doesn't pops up.\r\n\r\nI have no clue what could be the cause of this strange behaviour.\r\n\r\nThings that I've already tried are listed below:\r\n\r\n- I precompiled the assets using\r\n\r\n> rake assets:precompile RAILS_ENV=production\r\n\r\n- I switched off the uglifier gem, in order to better debug my app on the web browser\r\n\r\n- I've completely removed the turbolinks gem, since in the past I've had conflicts between turbolinks and some javascript files: $(document).ready(function() { }\r\n\r\nI don't know what else could I do, if you guys need more information in order help me to solve my problem, I'd be glad to provide it to you.\r\n\r\nI believe the problem could be on my **config/environments/production.rb**, here you are a code snippet of the parameters I think are related to my problem.\r\n\r\n```\r\nRails.application.configure do\r\n  # Settings specified here will take precedence over those in config/application.rb.\r\n\r\n  # Code is not reloaded between requests.\r\n  config.cache_classes = true\r\n\r\n  # Eager load code on boot. This eager loads most of Rails and\r\n  # your application in memory, allowing both threaded web servers\r\n  # and those relying on copy on write to perform better.\r\n  # Rake tasks automatically ignore this option for performance.\r\n  config.eager_load = true\r\n\r\n  # Full error reports are disabled and caching is turned on.\r\n  config.consider_all_requests_local       = false\r\n\r\n  # Disable serving static files from the `/public` folder by default since\r\n  # Apache or NGINX already handles this.\r\n  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\r\n\r\n  # Compress JavaScripts and CSS.\r\n  # config.assets.js_compressor = :uglifier\r\n  # config.assets.css_compressor = :sass\r\n\r\n  # Do not fallback to assets pipeline if a precompiled asset is missed.\r\n  config.assets.compile = false\r\n\r\n  # Asset digests allow you to set far-future HTTP expiration dates on all assets,\r\n  # yet still be able to expire them through the digest params.\r\n  config.assets.digest = true\r\n\r\n  # etc...\r\n\r\nend\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails/issues/comments/211048631","html_url":"https://github.com/Nerian/bootstrap-datepicker-rails/issues/116#issuecomment-211048631","issue_url":"https://api.github.com/repos/Nerian/bootstrap-datepicker-rails/issues/116","id":211048631,"user":{"login":"KarlHeitmann","id":3003032,"avatar_url":"https://avatars.githubusercontent.com/u/3003032?v=3","gravatar_id":"","url":"https://api.github.com/users/KarlHeitmann","html_url":"https://github.com/KarlHeitmann","followers_url":"https://api.github.com/users/KarlHeitmann/followers","following_url":"https://api.github.com/users/KarlHeitmann/following{/other_user}","gists_url":"https://api.github.com/users/KarlHeitmann/gists{/gist_id}","starred_url":"https://api.github.com/users/KarlHeitmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KarlHeitmann/subscriptions","organizations_url":"https://api.github.com/users/KarlHeitmann/orgs","repos_url":"https://api.github.com/users/KarlHeitmann/repos","events_url":"https://api.github.com/users/KarlHeitmann/events{/privacy}","received_events_url":"https://api.github.com/users/KarlHeitmann/received_events","type":"User","site_admin":false},"created_at":"2016-04-17T16:03:51Z","updated_at":"2016-04-17T16:03:51Z","body":"Hi @Nerian  ! \r\n\r\n> I would suggest that you take a look at the html on production and see what the compiled JS has. Look for the Datepicker stuff. That will tell you if the datepicker JS is there.\r\n\r\nI did a \r\n\r\n` $ cat public/assets/application-<lots-of-numbers>.js  | grep datepicker\r\n`\r\nAnd I found results showing the \"datepicker\" pattern, so the code has been compiled correctly.\r\n\r\n> Also, is there any error on the JS console?\r\n\r\nWhat a rookie mistake! I've completely forgotten to check out the JS console!!!\r\nNow that you remind me, I've found out that there are some errors:\r\n\r\n**ERRORS ON DEVELOPMENT ENVIRONMENT**\r\n\r\n- Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)\r\n- TypeError: Tooltip is undefined\r\n- TypeError: $(...).popover is not a function\r\n\r\n**ERRORS ON PRODUCTION ENVIRONMENT**\r\n\r\n- Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)\r\n- TypeError: $(...).popover is not a function\r\n\r\nAs you can see, stangely there are more errors on development mode rather than production mode. However, the datepicker is appearing on development mode despite it shows me more errors. If I click the error line of the second error message on development mode, it redirects me to this code snippet:\r\n\r\n```\r\n  var Default = $.extend({}, Tooltip.Default, {\r\n    placement: 'right',\r\n    trigger: 'click',\r\n    content: '',\r\n    template: '<div class=\"popover\" role=\"tooltip\">' + '<div class=\"popover-arrow\"></div>' + '<h3 class=\"popover-title\"></h3>' + '<div class=\"popover-content\"></div></div>'\r\n  });\r\n```\r\nIf I execute the following command on my production server:\r\n\r\n`$ cat public/assets/application-<lots-of-numbers>.js  | grep 'var Default = $.extend({}, Tooltip.Default, {'`\r\n\r\nI get no results.\r\n\r\nAnyways, I'm going to include Tether and the I'm going to tell you my results... maybe if I solve this dependency that before I was unaware of, the problem would solve. Thank you.\r\n\r\nHi @svavantsa !\r\n\r\n> The way I've used date picker is by making the class name \"datepicker\". Not data provider. I think that's what the documentation said too.\r\n\r\nSure, I believe you are right, I was inspired by an example some time ago, and it worked for me (at least on development environment). Nevertheless, I'm also having the same trouble with a gem related to bootstrap: the *Bootstrap-Image-Gallery-Rails*. It's usefull to implement a image gallery on a rails application, using some bootstrap elements. The trouble is the same, it runs OK on development mode, but in production mode the image gallery is disabled.\r\n\r\nRight now, I believe if I solve the Tether dependency, both problems will vanish.\r\n\r\nThank you both for your feedback!\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}