Rich Gem&的问题Rails 4中的活动管理员

时间:2015-06-02 06:30:15

标签: ruby-on-rails ruby ckeditor activeadmin

Rails 4.1.7

Ruby 2.1.5

基本上,我只需要为Active Admin添加一个Ckeditor表单。

我在为活动管理员集成Rich Gem时遇到了问题。

更新

Rich Gem仅支持Formtastic和1和2,它不支持3,尽管已经完成patch来支持Formtastic 3 +。

我目前正在使用formtastic(〜> 3.1)。

Rendered /Users/adam/.rvm/gems/ruby-2.1.5@blog/bundler/gems/activeadmin-ed1fbca8c64a/app/views/active_admin/resource/new.html.arb (752.4ms)
Completed 500 Internal Server Error in 766ms

LoadError (Unable to autoload constant RichInput, expected /Users/adam/.rvm/gems/ruby-2.1.5@blog/gems/rich-1.4.6/app/inputs/rich_input.rb to define it):
  app/admin/recipe.rb:42:in `block (5 levels) in <top (required)>'
  app/admin/recipe.rb:39:in `block (4 levels) in <top (required)>'
  app/admin/recipe.rb:38:in `block (3 levels) in <top (required)>'
  app/admin/recipe.rb:24:in `block (2 levels) in <top (required)>'

跑完后,这一行

➜  blog git:(master) ✗ rails generate rich:install
 create  config/initializers/rich.rb
   route  mount Rich::Engine => '/rich', :as => 'rich'
  create  app/assets/stylesheets/rich/editor.css
  create  app/assets/javascripts/rich.js
    rake  rich:install:migrations


git://github.com/activeadmin/activeadmin.git (at master) is not yet checked out. Run `bundle install` first.

目前,我正在使用github的activeadmin gem。如果我将其切换为主人,我会遇到其他问题(与AA相关)。

的Gemfile

gem 'rails', '4.1.7'
...
gem 'rich'
gem "paperclip", "~> 4.2"
gem 'activeadmin', github: 'activeadmin'

Gemfile Lock

GIT
  remote: git://github.com/activeadmin/activeadmin.git
  revision: ed1fbca8c64af827616c58f274d7be256ca513b6
  specs:
    activeadmin (1.0.0.pre)
      arbre (~> 1.0, >= 1.0.2)
      bourbon
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (~> 1.6)
      jquery-rails
      jquery-ui-rails (~> 5.0)
      kaminari (~> 0.15)
      rails (>= 3.2, < 5.0)
      ransack (~> 1.3)
      sass-rails

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.1.7)
      actionpack (= 4.1.7)
      actionview (= 4.1.7)
      mail (~> 2.5, >= 2.5.4)
    actionpack (4.1.7)
      actionview (= 4.1.7)
      activesupport (= 4.1.7)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.7)
      activesupport (= 4.1.7)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.7)
      activesupport (= 4.1.7)
      builder (~> 3.1)
    activerecord (4.1.7)
      activemodel (= 4.1.7)
      activesupport (= 4.1.7)
      arel (~> 5.0.0)
    activesupport (4.1.7)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    arbre (1.0.3)
      activesupport (>= 3.0.0)
    arel (5.0.1.20140414130214)
    bcrypt (3.1.10)
    bourbon (3.2.4)
      sass (~> 3.2)
      thor
    builder (3.2.2)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.7)
      climate_control (>= 0.0.3, < 1.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.9.1)
    commonjs (0.2.7)
    devise (3.4.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    erubis (2.7.0)
    execjs (2.3.0)
    formtastic (3.1.3)
      actionpack (>= 3.2.13)
    formtastic_i18n (0.1.1)
    has_scope (0.6.0)
      actionpack (>= 3.2, < 5)
      activesupport (>= 3.2, < 5)
    hike (1.2.3)
    i18n (0.7.0)
    inherited_resources (1.6.0)
      actionpack (>= 3.2, < 5)
      has_scope (~> 0.6.0.rc)
      railties (>= 3.2, < 5)
      responders
    jbuilder (2.2.8)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.2)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.3)
      railties (>= 3.2.16)
    json (1.8.2)
    kaminari (0.16.3)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    less (2.6.0)
      commonjs (~> 0.2.7)
    less-rails (2.6.0)
      actionpack (>= 3.1)
      less (~> 2.6.0)
    libv8 (3.16.14.7)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mime-types (2.4.3)
    minitest (5.5.1)
    multi_json (1.10.1)
    mysql2 (0.3.18)
    orm_adapter (0.5.0)
    paperclip (4.2.1)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types
    polyamorous (1.1.0)
      activerecord (>= 3.0)
    rack (1.5.2)
    rack-raw-upload (1.1.1)
      multi_json
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.1.7)
      actionmailer (= 4.1.7)
      actionpack (= 4.1.7)
      actionview (= 4.1.7)
      activemodel (= 4.1.7)
      activerecord (= 4.1.7)
      activesupport (= 4.1.7)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.7)
      sprockets-rails (~> 2.0)
    railties (4.1.7)
      actionpack (= 4.1.7)
      activesupport (= 4.1.7)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    ransack (1.6.3)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.1)
    rdoc (4.2.0)
      json (~> 1.4)
    ref (1.0.5)
    responders (1.1.2)
      railties (>= 3.2, < 4.2)
    rich (1.4.6)
      jquery-rails
      kaminari
      mime-types
      paperclip
      rack-raw-upload
      rails (>= 3.2.0)
      sass-rails
    sass (3.2.19)
    sass-rails (4.0.5)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.2)
      sprockets (~> 2.8, < 3.0)
      sprockets-rails (~> 2.0)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    spring (1.3.2)
    sprockets (2.12.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.2.4)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    therubyracer (0.12.1)
      libv8 (~> 3.16.14.0)
      ref
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    turbolinks (2.5.3)
      coffee-rails
    twitter-bootstrap-rails (3.2.0)
      actionpack (~> 4.1)
      execjs (~> 2.2)
      rails (~> 4.1)
      railties (~> 4.1)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    warden (1.2.3)
      rack (>= 1.0)

PLATFORMS
  ruby

DEPENDENCIES
  activeadmin!
  coffee-rails (~> 4.0.0)
  devise
  jbuilder (~> 2.0)
  jquery-rails
  less-rails
  mysql2
  paperclip (~> 4.2)
  rails (= 4.1.7)
  rich
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  spring
  therubyracer
  turbolinks
  twitter-bootstrap-rails
  uglifier (>= 1.3.0)

1 个答案:

答案 0 :(得分:2)

嗯,这总是最后一个在版本依赖性方面尝试的选项,但解决了这个问题。

下载rich gem并手动将其放在vendor文件夹中。之后,您必须在路线文件

中提及此内容
gem 'rich', path: 'vendor/rich(actual folder name)'

然后,您可以执行以下操作

rails generate rich:install

应该好好去,如果你被困在某个地方,请告诉我。