olleh
olleh

Reputation: 1277

Issue with Rich Gem & Active Admin in Rails 4

Rails 4.1.7

Ruby 2.1.5

Basically, I just need to add a Ckeditor Form for Active Admin.

I've got a problem integrating the Rich Gem for Active Admin.

Update:

Rich Gem supports only Formtastic and 1 and 2, it doesn't support 3, although a patch has been done to support Formtastic 3+.

I am currently using 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)>'

After running, this line

➜  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.

Currently, I'm using the activeadmin gem from github. If I switch it to master I encounter other issues (related to 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)

Upvotes: 0

Views: 735

Answers (1)

Caffeine Coder
Caffeine Coder

Reputation: 1879

Well , this is always the last option to be tried when it comes to version dependencies but solves the problem .

Download the rich gem and manually place it in the vendor folder . After that , you will have to mention this in the routes file

gem 'rich', path: 'vendor/rich(actual folder name)'

Then , you can do the following

rails generate rich:install

Should be good to go , do let me know if you get stuck somewhere .

Upvotes: 2

Related Questions