Active admin install error - ruby-on-rails

I have an error, when try to run command:
rails g active_admin:install
The error is:
user#user1:~/projectX$ rails g active_admin:install
invoke devise
/home/user/.rvm/gems/ruby-2.2.0/bundler/gems/activeadmin-6bde1f57ec5f/lib/generators/active_admin/devise/devise_generator.rb:21:in rescue in install_devise': uninitialized constant ActiveAdmin::Generators::DeviseGenerator::DependencyError (NameError)
from /home/user/.rvm/gems/ruby-2.2.0/bundler/gems/activeadmin-6bde1f57ec5f/lib/generators/active_admin/devise/devise_generator.rb:19:ininstall_devise'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:ineach'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:ininvoke_all'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in dispatch'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:ininvoke'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:277:in block in _invoke_for_class_method'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/shell.rb:68:inwith_padding'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:266:in _invoke_for_class_method'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:133:in_invoke_from_option_users'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:ineach'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:ininvoke_all'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in dispatch'
from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:instart'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/generators.rb:157:in invoke'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/generate.rb:13:in'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:in require_command!'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:130:ingenerate_or_destroy'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:50:in generate'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in <top (required)>'
from /home/user/projectX/bin/rails:8:in'
from /home/user/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'
from /home/user/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from -e:1:in `'
Active admin and devise gems are installed. The only problem is when I generate active admin. I use Rails-4.1.8 and ruby-2.1.4.
Thanks for help and good day.

You need to add the gem 'devise' to your Gemfile or directly using the cli
bundle add devise
or you need to run the install with the the --skip-users flag.
rails g active_admin:install --skip-users

activeadmin gem (I mean latest version of gem on rubygems.org) still is not compatible with Rails 4.x.
Try to use use latest version of activeadmin from repository:
gem 'activeadmin', github: 'activeadmin/activeadmin', branch: :master

Works for me.
gem 'devise', '~> 3.2'

Related

Error initializing ShortCode Gem

I have a problem initializing the Rails Gem shortcode.
I have this code in initializers / shortcode.rb
Shortcode.setup do |config|
config.template_parser = :haml
config.template_path = "support/templates/chart"
config.block_tags = [:chart]
end
When I start the server rails (rails s) gives the following error.
/home/usuario/proyectos/rails/crowdfunding/config/initializers/shortcode.rb:3:in `<top (required)>': uninitialized constant Shortcode (NameError)
from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166:in `instrument'
from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:651:in `load_config_initializer'
Note: I already did install bundle and bundle update sass-rails
Shortcode is not a Rails gem but the ruby gem [thus Rails come without this gem as its dependency]. Add gem 'shortcode' in your Gemfile, bundle the project and restart the application.

uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES (NameError)

Im having a problem with running my rails server. ive set the abstract_mysql2_adapters at initializer that consist of:
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end
and it solved my rake db:migrate problem, but when i try to run my rails server it gives me this error.
C:/Users/XXXX/Documents/RoRCmS/simple_cms/config/initializers/abstract_mysql2_adapter.rb:2:in <class:Mysql2Adapter>': uninitialized constant ActiveRecord::ConnectionAda
pters::Mysql2Adapter::NATIVE_DATABASE_TYPES (NameError)
from C:/Users/John/Documents/RoRCmS/simple_cms/config/initializers/abstract_mysql2_adapter.rb:1:in'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/engine.rb:609:in block (2 levels) in <class:Engine>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/engine.rb:608:ineach'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/engine.rb:608:in block in <class:Engine>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:ininstance_exec'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in run'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:inblock in run_initializers'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:228:in block in tsort_each'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:431:in each_strongly_connected_component_from'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:349:inblock in each_strongly_connected_component'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:347:in each'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:347:incall'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:347:in each_strongly_connected_component'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:226:intsort_each'
from C:/Ruby23-x64/lib/ruby/2.3.0/tsort.rb:205:in tsort_each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:inrun_initializers'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/application.rb:215:in initialize!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from C:/Users/John/Documents/RoRCmS/simple_cms/config/environment.rb:5:in <top (required)>'
from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:3:inrequire'
from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:3:in block in <main>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:ininstance_eval'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in initialize'
from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:innew'
from C:/Users/John/Documents/RoRCmS/simple_cms/config.ru:in <main>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:ineval'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in new_from_string'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:40:inparse_file'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:277:in build_app_and_options_from_config'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:199:inapp'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in app'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:314:inwrapped_app'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in start'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands.rb:78:inblock in '
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in tap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in'
from bin/rails:4:in require'
from bin/rails:4:in'
I really need to solve this problem now.. thanks guys.
I solved it as follows. After importing a legacy sql dumpfile into MySQL with mysql -u username -p database_name < file.sql, I proceeded to perform a migration with bin/rake db:migrate, but I encountered the error Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead.
So I tried the same monkey patch as you, as suggested by user pjg here https://github.com/rails/rails/pull/13247#issuecomment-32425844, but then I encountered your error
uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES (NameError)
I followed user John Geliberte's advice and updated my Gemfile with gem 'activerecord-native_db_types_override' and checked that I also had gem 'mysql2' (NOT 'activerecord-mysql2-adapter' which causes other errors) and ran bundle install.
I used the the documentation associated with the activerecord-native_db_types_override gem and applied property for NATIVE_DATABASE_TYPES mentioned in Rails ActiveRecord library file for abstract_mysql_adapter, such that I made the following changes:
I created config/initializers/abstract_mysql2_adapter.rb and added:
require 'active_record/connection_adapters/mysql2_adapter'
NativeDbTypesOverride.configure({
ActiveRecord::ConnectionAdapters::Mysql2Adapter => {
primary_key: "int(11) auto_increment PRIMARY KEY"
}
})
I created config/environment.rb and add the following to load the monkey patch:
require File.expand_path('../initializers/abstract_mysql2_adapter.rb', __FILE__)
I checked that config/database.yml contained 'adapter: mysql2' for the db connection I wanted to use.
I then ran bin/rake db:migrate and it successfully performed the migration.
I have made a pull request to the documentation for the ActiveRecord Native Database Types Override Gem.
It was much easier to downgrade from MySQL 5.7 to 5.5 instead though.
My system:
mysql -V is mysql Ver 14.14 Distrib 5.7.13
rails -v is 4.2.4
ruby -v is ruby 2.3.0p0
SOLVED: i added the gem : gem 'activerecord-native_db_types_override'
Try this code instead:
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
def modify_types(types)
super
types[:primary_key] = "int(11) auto_increment PRIMARY KEY"
types
end
end

NoMethodError: undefined method `[]' for nil:NilClass for assets:precompile on heroku

An app using devise and omniauth is working well on localhost, but when I deploy it on heroku, I get an error:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/config/initializers/omniauth.rb:6:in `block in <top (required)>'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/omniauth-1.2.2/lib/omniauth/builder.rb:6:in `initialize'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:43:in `new'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:43:in `build'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:118:in `block in build'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:118:in `each'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:118:in `inject'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:118:in `build'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/engine.rb:498:in `app'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/application/finisher.rb:36:in `block in <module:Finisher>'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/config/environment.rb:5:in `<top (required)>'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/application.rb:276:in `require_environment!'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.4/lib/rails/application.rb:379:in `block in run_tasks_blocks'
/tmp/build_e711adadeab2d8cb9d37632e4c0ba08b/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:my-app.git
! [remote rejected] master -> master (pre-receive hook declined)
Here is Gemfile and omniauth files:
#Gemfile:
#....
gem 'google-api-client'
gem 'omniauth'
gem 'omniauth-google-oauth2'
gem 'devise'
#.....
#config/initializers/omniauth.rb
# probably this isn't necessary
if Rails.env.production?
OmniAuth.config.full_host = 'https://my-app.herokuapp.com'
end
# but it is necessary
Rails.application.config.middleware.use OmniAuth::Builder do
provider(:google_oauth2, $ga_client['client_id'], $ga_client['client_secret'],
{ scope: 'userinfo.profile, userinfo.email, analytics', access_type: 'offline', prompt: 'consent' }
)
end
In your code, $ga_client is nil. You are not defining such an array anywhere in your file and, in case is defined in other place, it's not loaded at the time this initializer is executed.
Try setting the client_id and client_secret with environment variables, as recommended in the docs.
provider :google_auth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
The globals variables weren't initialized:
# but it is necessary
Rails.application.config.middleware.use OmniAuth::Builder do
provider(:google_oauth2, $ga_client['client_id'], $ga_client['client_secret'],
{ scope: 'userinfo.profile, userinfo.email, analytics', access_type: 'offline', prompt: 'consent' }
)
end
# ops $ga_client is nil
I discovered it when I replaced the code above with:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"]
end
I was having the same problem. The cause of this problem is that Rails uses a database system called sqlite3, Heroku does not use this database. To fix this, go into your Gemfile and scroll down until you see something which will look a bit like this
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
end
Note: If you are using any versions lower than Rails 4.0.0, you will not have this group, simply create it.
Now somewhere at the top of your Gemfile, will be a line which says
gem 'sqlite3'
Move this line into the Development, Test Group This now will only run in development. You can now try creating your Heroku app again by writing
$ heroku create
Then you may need to migrate your database. Do this by running
$ rake db:migrate
Now push to Heroku
$ heroku push
That should work!
Hope I helped ;)

Connection Refused Error Trying to Import ElasticSearch Model through Rake on Heroku

For some reason, on heroku it will not allow me to import models (this is for the Bonsai ElasticSearch add-on). It's just showing connection refused. I'm not sure how to resolve this. I've searched the internet and I can't find anything that will even hint me in the right direction to solve this. I checked to make sure the server was up and manually created the index with curl. Do the initializers get launched when running a rake task?
I set the elasticsearch url in the config/initializers/bonsai.rb file:
config/initializers/bonsai.rb
if Rails.env == 'production'
ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']
end
Gemfile snippet
# Used for elastic search
gem 'elasticsearch-model', github: 'elasticsearch/elasticsearch-rails'
gem 'elasticsearch-rails', github: 'elasticsearch/elasticsearch-rails'
gem 'multi_json'
gem 'json'
Error
heroku run rake environment elasticsearch:import:all DIR=app/models
Running `rake environment elasticsearch:import:all DIR=app/models` attached to terminal... up, run.5751
[IMPORT] Loading models from: app/models
[IMPORT] Processing model: Firm...
rake aborted!
Connection refused - connect(2)
/app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:80:in `perform_request'
/app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:39:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
/app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
/app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
/app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/base.rb:187:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
/app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/client.rb:102:in `perform_request'
/app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-api-1.0.1/lib/elasticsearch/api/actions/bulk.rb:81:in `bulk'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-model/lib/elasticsearch/model/importing.rb:78:in `block in import'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-model/lib/elasticsearch/model/adapters/active_record.rb:88:in `block in __find_in_batches'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.0/lib/active_record/relation/batches.rb:125:in `find_in_batches'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.0/lib/active_record/querying.rb:9:in `find_in_batches'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-model/lib/elasticsearch/model/proxy.rb:80:in `method_missing'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-model/lib/elasticsearch/model/adapters/active_record.rb:86:in `__find_in_batches'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-model/lib/elasticsearch/model/importing.rb:77:in `import'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-model/lib/elasticsearch/model.rb:113:in `import'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-rails/lib/elasticsearch/rails/tasks/import.rb:59:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-rails/lib/elasticsearch/rails/tasks/import.rb:99:in `block (4 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-rails/lib/elasticsearch/rails/tasks/import.rb:82:in `each'
/app/vendor/bundle/ruby/2.0.0/bundler/gems/elasticsearch-rails-26a3ba246968/elasticsearch-rails/lib/elasticsearch/rails/tasks/import.rb:82:in `block (3 levels) in <top (required)>'
Tasks: TOP => elasticsearch:import:model
(See full trace by running task with --trace)
by the way can someone create an 'elasticsearch-rails' tag since its the upcoming replacement for Tire
Elasticsearch Rails does not use the same mechanism as Tire to set its URL in production on Heroku. To have this work correctly with Bonsai search, you have to have a different url specification. Fortunately a guy has made a gem (https://rubygems.org/gems/bonsai-elasticsearch-rails) to eliminate the needless, mandatory creation of a initializer by everyone.
Simply add this gem to your gem file under your production group. The version may be subject to change since it's so new:
gem 'bonsai-elasticsearch-rails', '~> 0.0.4'
If you're more curious about what this gem actually does, the entire source is below:
require "bonsai/elasticsearch/rails/version"
puts "Starting up a new ElasticSearch client with #{ENV['BONSAI_URL']}"
Elasticsearch::Model.client = Elasticsearch::Client.new url: ENV['BONSAI_URL']
I know, simple right...

issue installing active admin - rails 3.0.3 - uninitialized constant Formtastic::SemanticFormHelper

I'm trying to add activeadmin to my rails 3.0.3 app.
I'm following the instructions here
When I run - rake db:migrate I get the following error -
rake aborted!
uninitialized constant Formtastic::SemanticFormHelper
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:167:in `eval'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/resource_controller.rb:1:in `<top (required)>'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/dashboards/dashboard_controller.rb:3:in `<module:Dashboards>'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/dashboards/dashboard_controller.rb:2:in `<module:ActiveAdmin>'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/dashboards/dashboard_controller.rb:1:in `<top (required)>'
(eval):1:in `generate_dashboard_controller'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:167:in `eval'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:167:in `generate_dashboard_controller'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:38:in `initialize'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:147:in `new'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:147:in `find_or_create_namespace'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:282:in `load_default_namespace'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:188:in `load!'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:212:in `routes'
You seem to be missing the formtastic gem. In the current version of active-admin (0.3.2) it is correctly specified as a dependency.
So I hope updating the activeadmin gem (bundle update activeadmin) will fix it.
If that does not fix it, I would add formtastic explicitly to the Gemfile.
Hope this helps.
In rails 3 the Formtastic::SemanticFormHelper became => Formtastic::Helpers::FormHelper
Don't forget to load your lib. By default rails don't load them so you can just uncomment config.autoload_paths += %W(#{config.root}/lib) in your application.rb

Resources