如果您使用ActiveAdmin,您是否需要在宝石中使用sass?

时间:2013-02-20 21:08:46

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1 ruby-on-rails-3.2

我正在使用activeadmin gem,它应该在你进行bundle安装时安装sass。当我做一个捆绑秀时,我可以看到sass(3.2.5)存在。但是,当我从my:assets组中删除sass时,我的rake命令无法发出异常:

rake aborted!
cannot load such file -- sass-rails
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/active_admin/sass/helpers.rb:3:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/active_admin.rb:11:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/activeadmin.rb:1:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/activeadmin.rb:1:in `<top (required)>'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `each'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `block in require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `each'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler.rb:128:in `require'
/Users/kc025858/webApp/data-source-onboarding/config/application.rb:10:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/Rakefile:4:in `require'
/Users/kc025858/webApp/data-source-onboarding/Rakefile:4:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/rake_module.rb:25:in `load'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:604:in `raw_load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:89:in `block in load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:88:in `load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:72:in `block in run'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:70:in `run'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/bin/rake:37:in `<top (required)>'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385@global/bin/rake:19:in `load'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385@global/bin/rake:19:in `<main>'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>

为什么在已经包含ActiveAdmin时需要将sass包含在gem gem文件中?

如果你看到dependency.txt,你会发现sass是activeadmin的一部分。

activeadmin (0.5.1)
      arbre (>= 1.0.1)
      bourbon (>= 1.0.0)
      devise (>= 1.1.2)
      fastercsv
      formtastic (>= 2.0.0)
      inherited_resources (>= 1.3.1)
      jquery-rails (>= 1.0.0)
      kaminari (>= 0.13.0)
      meta_search (>= 0.9.2)
      rails (>= 3.0.0)
      sass (>= 3.1.0)

2 个答案:

答案 0 :(得分:0)

不确定原因,但ActiveAdmin的网站在其文档中明确指出您需要在gemfile中包含sass-rails:

If you are using Rails >= 3.1, you must also include a beta version of MetaSearch and sass-rails

答案 1 :(得分:0)

ActiveAdmin在其依赖项列表中有sass但不是sass-rails,这是在rails资产管道中添加sass适配器所必需的。