Vaibhav Dhoke
Vaibhav Dhoke

Reputation: 459

Sunspot solr rake issue

When I try to rake command I get this error. I have one application where solr runs properly, now I am trying to build a new application using solr I am unable to proceed

rake sunspot:install --trace

rake aborted!
LoadError: cannot load such file -- active_support/core_ext/object/to_json
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/sunspot_rails-2.0.0/lib/sunspot_rails.rb:4:in `require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/sunspot_rails-2.0.0/lib/sunspot_rails.rb:4:in `<top (required)>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
/home/vaibhav/Mirraw/testing_solr/config/application.rb:7:in `<top (required)>'
/home/vaibhav/Mirraw/testing_solr/Rakefile:4:in `require'
/home/vaibhav/Mirraw/testing_solr/Rakefile:4:in `<top (required)>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/rake_module.rb:28:in `load'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:93:in `load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:77:in `block in run'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:75:in `run'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/bin/rake:33:in `<top (required)>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/rake:23:in `load'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/rake:23:in `<main>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'

Here is my gem file,

source 'https://rubygems.org'

gem 'rails', '4.2.2'

gem 'sqlite3'

gem 'sass-rails', '~> 5.0'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.1.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 2.0'

gem 'sdoc', '~> 0.4.0', group: :doc

gem 'sunspot_rails'


group :development, :test do
  gem 'byebug'

  gem 'web-console', '~> 2.0'

  gem 'spring'

end

Does anyone has any solution to this problem.

Upvotes: 0

Views: 331

Answers (1)

Matouš Bor&#225;k
Matouš Bor&#225;k

Reputation: 15954

This appears to be a known problem. The problem is that Rails 4.1 renamed a file in ActiveSupport core extensions and sunspot_rails is still trying to include the old file name. This was resolved in this sunspot_rails commit but it still was not merged to the stable 2.0 branch of the sunspot_rails gem.

Overall this gem seems to be quite abandoned so your only option is to try to use the master branch of the gem directly from github, not the stable 2.0 branch.

You can do it by updating your Gemfile so that instead of:

gem 'sunspot_rails'

it will say:

gem 'sunspot_rails :github => 'sunspot/sunspot'

See more explanation here.

Upvotes: 2

Related Questions