ActiveAdmin uninitialized constant in Ruby on Rails

I got the following error after deploying my application in ec2.

Active Admin works fine in my local development environment, but as soon as I deploy using dockers, it seems like the stone is not installing.

If I test usage bundler show activeadmin, it shows that Active Admin is installed.

My gem file:

gem 'rails', '4.2.2'

gem 'mysql2', "~> 0.3.20"
# Use SCSS for stylesheets
gem 'sass-rails', '>= 3.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See htt                                                              
gem 'bcrypt', '3.1.7'
gem 'bootstrap-sass'
gem 'roo', '2.0.0'
gem 'iconv'
gem 'roo-xls'
gem 'omniauth-facebook'
gem 'omniauth'
gem 'fancybox-rails'
gem 'will_paginate'
gem 'bootstrap-will_paginate', '0.0.10'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'unicorn'

gem 'yaml_db'

gem 'figaro'

gem 'execjs'
gem 'therubyracer'

gem 'devise'
gem 'activeadmin', github: 'gregbell/active_admin'

gem 'rollbar', '~> 2.8.3'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

I searched for this problem, added require 'activeadmin'active_admin.rb to my initializer, and it does not work.

I use:

  • Ruby v2.2.0
  • Rails v4.2.2

When I Deploy In Docker Error Message

NameError: uninitialized constant ActiveAdmin
/app/config/initializers/active_admin.rb:1:in `<top (required)>'
/app/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)

dockerfile

# Dockerfile
FROM seapy/rails-nginx-unicorn-pro:v1.0-ruby2.2.0-nginx1.6.0
MAINTAINER seapy(iamseapy@gmail.com)

# Add here your preinstall lib(e.g. imagemagick, mysql lib, pg lib, ssh config)
RUN apt-get update
RUN apt-get install -qq -y mysql-server mysql-client libmysqlclient-dev


#(required) Install Rails App
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install --without development test
RUN bundle update
ADD . /app

#(required) nginx port number
EXPOSE 80

when i added require 'activeadmin'

rake aborted!
/opt/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/orm_adapter-0.5.0/lib/orm_adapter/adapters/active_record.rb:81: warning: already initialized constant ActiveRecord::Base::OrmAdapter
/opt/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/orm_adapter-0.5.0/lib/orm_adapter/adapters/active_record.rb:81: warning: previous definition of OrmAdapter was here
NoMethodError: undefined method `default_timezone=' for #<Class:0x007ff5e0f92008>
/app/config/initializers/active_admin.rb:1:in `<top (required)>'
/app/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
+4
source share

All Articles