rails active admin deployment : couldn't find file 'jquery-ui'

前端 未结 6 2228
情深已故
情深已故 2020-12-04 17:03

when trying to deploy with capistrano, when capistrano use command bundle exec rake

    RAILS_ENV=production 
    RAILS_GROUPS=assets 
    assets:precompile         


        
相关标签:
6条回答
  • 2020-12-04 17:03

    In my case, the jquery issue was due to a gem I was using. I wasn't using jquery directly, so adding app/assets/js/jquery-ui.js to my project didn't help.

    Adding gem "jquery-rails", "< 3.0.0" to my gemfile fixed it, but I got an issue with turbolinks immediately after that, which is easy enough to fix...

    My final gemfile:

    # Temporary fix for jquery issue
    gem "jquery-rails", "< 3.0.0"
    gem 'turbolinks'
    

    ... easy peasy

    0 讨论(0)
  • 2020-12-04 17:04

    Though the Pull request has been merged into AA by now, you will still have this problem if you work with the latest release of AA. I don't like to force JQuery-rails down to version 2.3.0 so here's an alternative solution to the problem: In the active_admin.js file replace

    //= require active_admin/base
    

    with

    //= require jquery
    //= require jquery_ujs
    //= require jquery.ui.core
    //= require jquery.ui.widget
    //= require jquery.ui.datepicker
    //= require active_admin/application
    

    kudos to Fred for providing that solution here.

    0 讨论(0)
  • 2020-12-04 17:08

    Well, there is no need to downgrade jquery-rails to 2.3.0 or specify a GitHub branch. Just use jquery-ui-rails. To workaround the file name differences:

    Simply create app/assets/javascripts/jquery-ui.js

    //= require jquery.ui.all
    

    Create app/assets/stylesheets/jquery-ui.css

    /*
     *= require jquery.ui.all
     */
    

    These load the correct files to satisfy ActiveAdmin

    0 讨论(0)
  • 2020-12-04 17:15

    Downgrading "jquery-rails" to "2.3.0" fixed this issue for me as well.

    0 讨论(0)
  • 2020-12-04 17:18

    The "jquery-rails" gem recently removed jQuery UI.

    https://github.com/rails/jquery-rails/commit/2fdcdb2633cbc6426d412c050200fc31d14b9a3b

    They recommend using the jquery-ui-rails gem.

    There is an active pull request (as of this writing) to add that gem as a dependency. However, the developers of ActiveAdmin have stated that they are "locking it down until we officially drop support for Rails 3.0". The version they are locked to is jquery-rails < 3.0.0.

    In the meantime, just modify your Gemfile:

    gem "jquery-ui-rails" Not recommended, see @Kevin's comment below

    Or you can downgrade your version of jquery-rails:

    gem "jquery-rails", "< 3.0.0"
    

    Or you can pull from their Github master branch. They have applied a temporary fix.

    gem "activeadmin", github: "gregbell/active_admin"
    
    0 讨论(0)
  • 2020-12-04 17:22

    I know this is already solved. But I want to give one more solution to this that worked for me.

    I am running Rails 4.0.8 when having this issue.

    I simply remove explicit version number for jquery-rails gem jquery-ui-rails gem.

    Mine looks like this essentially:

    # js
    gem 'jquery-ui-rails'
    gem 'jquery-rails'
    
    # rails admin
    gem 'rails_admin'
    

    Gemfile.lock kinda figured out the correct version for all three gems automatically.

    0 讨论(0)
提交回复
热议问题