This is the error in my logs when I try to create a new model:
/rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/configuration.rb:7: Configuration is not a class (TypeError)
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb:23
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/init.rb:2
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/plugin.rb:81
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:134:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
from /rubyprograms/dreamstill/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:103:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:103:in `require_environment!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/commands.rb:16
from script/rails:6:in `require'
from script/rails:6
It's from the has_many_polymorphs plugin...
here is config/environment.rb:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dreamstill::Application.initialize!
This is /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/configuration.rb:
module Rails #:nodoc:
class Configuration
def has_many_polymorphs_options
::HasManyPolymorphs.options
end
def has_many_polymorphs_options=(hash)
::HasManyPolymorphs.options = HashWithIndifferentAccess.new(hash)
end
end
end
The quick answer:
Your has_many_polymorphs plugin is broken. And I think you've included it in your environment.rb file on LINE 5
UPD
as you can see /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb:23 there is an error in has_many_polymorphs.rb file n line 23. Fix it :D. Or don't use broken plugins.
rails plugin remove has_many_polymorphs
Related
I am trying to require google-search gem inside a helper module, but getting the following error on require cannot load such file -- google-search. This is working well at the local system, but causing problems at the production server. Though I can find the gem when I run gem list. Unable to figure out the problem.
module TestHelper
require 'google-search'
end
Error stacktrace
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
from (irb):2
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.0.1/lib/rails/commands/console.rb:90:in `start'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.0.1/lib/rails/commands/console.rb:9:in `start'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.0.1/lib/rails/commands.rb:62:in `<top (required)>'
What can be the issue? How to debug the problem?
After reading http://codedecoder.wordpress.com/2013/09/23/require-and-load-in-ruby-loaderror-cannot-load-such-file/ I tried $LOAD_PATH which also doesn't show google-search. So I tried to require google-search by giving the fullpath
require '/home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/google-search-1.0.3/lib/google-search.rb'
which gives this error
'/home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/google-search-1.0.3/lib/google-search.rb'
LoadError: cannot load such file -- google-search/version
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/google-search-1.0.3/lib/google-search.rb:26:in `<top (required)>'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
from (irb):27
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.0.1/lib/rails/commands/console.rb:90:in `start'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.0.1/lib/rails/commands/console.rb:9:in `start'
from /home/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.0.1/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:
Also bundle show doesn't show the gem.
My rails app fails to load when I have the following line in application.rb:
Bundler.require(:default, Rails.env)
I get the following error:
.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:13:in `[]': no implicit conversion of Symbol into Integer (TypeError)
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:13:in `initialize'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:85:in `new'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:85:in `initializer'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:6:in `<class:Railtie>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:5:in `<module:Rolify>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:4:in `<top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify.rb:1:in `<top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `each'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `block in require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `each'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler.rb:131:in `require'
from /Users/gerardkelly/Web Development/Rails Apps/Rails 4/po-app/config/application.rb:5:in `<top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Looks as though it's complaining about the params being sent in - which is odd because this is pre-baked Rails stuff. Note that the Bundler.require is application.rb:5 which its complaining about.
I'm on Rails 4, Ruby 2.0.0
Looks like the rollify gem you are using (so it's not clean rails project :P) has some issues in rails 4.x series.
Check this out: https://github.com/EppO/rolify/pull/218 there is a fork that already fixes that.
Ive recently install the 'ar-extension' gem. After installation when i run rails c or rails s i gets the following error :
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:427:in `<class:SqliteRegexp>': undefined method `class_inheritable_accessor' for ActiveRecord::Extensions::SqliteRegexp:Class (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:426:in `<module:Extensions>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:112:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/init.rb:10:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
from /home/infibeam/Aptana_studio_3/workspace/DigitalAssetManagement/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've google for the error but in vain..Plz help me to know what xactly is going wrong.
The gem you're trying to use is not compatible with rails 3.2. class_inheritable_accessor has been deprecated in favor of class_attribute.
You can look for rails 3.2 fork of this gem, do your own port, or search for substitutes.
actually ar-extensions doesnt work with rails3 for rails 3 we have active import as the alternative and it works absolutely fine..;)
Please use a activerecord-import gem for rails 3
https://github.com/zdennis/activerecord-import/wiki
books = []
10.times do |i|
books "book #{i}")
end
Book.import books
I'm using RSpec for testing and when I left work Friday afternoon, my tests were passing. But when I went home and synced my repository, the tests failed on my laptop. Now back at work, the tests are failing still. Don't believe its my code since running rspec by itself returns an error and spork won't even start up. When I try to start Spork, I get the following error message:
Using RSpec
Loading Spork.prefork block...
uninitialized constant ActionView::Template::Handlers::ERB::ENCODING_FLAG (NameError)
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rspec-core-2.2.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:85:in `<class:ERB>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:70:in `<module:Handlers>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:28:in `<class:Template>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:27:in `<module:ActionView>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:6:in `<top (required)>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers.rb:10:in `extended'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:99:in `extend'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:99:in `<class:Template>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:8:in `<module:ActionView>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:6:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/resolver.rb:3:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_view/testing/resolvers.rb:1:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rspec-rails-2.2.1/lib/rspec/rails/view_rendering.rb:1:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rspec-rails-2.2.1/lib/rspec/rails.rb:9:in `<top (required)>'
<internal:lib/rubygems/custom_require>:33:in `require'
<internal:lib/rubygems/custom_require>:33:in `rescue in require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/Projects/Rails/vahsfbhistory/spec/spec_helper.rb:10:in `block in <top (required)>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork.rb:23:in `prefork'
/home/jeff/Projects/Rails/vahsfbhistory/spec/spec_helper.rb:5:in `<top (required)>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/test_framework.rb:138:in `load'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/test_framework.rb:138:in `block (2 levels) in preload'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/app_framework.rb:64:in `preload'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/test_framework.rb:134:in `block in preload'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork.rb:67:in `exec_prefork'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/test_framework.rb:120:in `preload'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:25:in `preload'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/runner.rb:74:in `run'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/lib/spork/runner.rb:9:in `run'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/spork-0.8.4/bin/spork:10:in `<top (required)>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/bin/spork:19:in `load'
/home/jeff/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/bin/spork:19:in `<main>'
Anyone know what could be causing this?
I ran into this problem. In the spec_helper.rb try replacing:
require "rails"
with
require "rails/all"
Worked in my situation.
You need to initialize environment, add this line to spec_helper.rb:
require File.expand_path("../../config/environment", __FILE__)
You may encounter this issue if you're trying to use rspec-rails in a non-rails project. In that case using require "rails/all" is not an option because it'd require ActiveRecord stuff leaving you with:
ActiveRecord::ConnectionNotEstablished: No connection pool with 'primary' found.
Instead you can fix this issue with:
require "action_controller/railtie"
If it's not a Rails app and you don't want to include all of Rails, add this to your spec_helper.rb:
require 'action_view'
I have some code that is using SyncEnumerator. As you can see here, SyncEnumerator requires generator.rb. To include this, the developer of this plugin has require 'generator'. This worked on my previous Rails installation but is not working since I upgraded OS X and reinstalled Rails. Now when I try to install my gems, I get:
Macintosh:mls TAmoyal$ sudo rake gems:install
(in /Users/TAmoyal/Desktop/RoR_Projects/mls)
rake aborted!
no such file to load -- generator
(See full trace by running task with --trace)
Stack Trace:
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require': no such file to load -- generator (MissingSourceFile)
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook/importer/page_scraper.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook/importer/aol.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook.rb:68:in `block in <top (required)>'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook.rb:68:in `each'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook.rb:68:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/init.rb:1:in `block in evaluate_init_rb'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:146:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:146:in `block in evaluate_init_rb'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:142:in `evaluate_init_rb'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:48:in `load'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:38:in `block in load_plugins'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in `load_plugins'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:348:in `load_plugins'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:163:in `process'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
from /Users/TAmoyal/Desktop/RoR_Projects/mls/config/environment.rb:13:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/commands/server.rb:84:in `<top (required)>'
from script/server:3:in `require'
from script/server:3:in `<main>'
Anyone know how to solve this?
Thanks!
The problem has nothing to do with Rails. Both SyncEnumerator and Generator are part of the Ruby Core Library. You should have both in Ruby 1.8.x.
Could you post the full exception trace?
EDIT:
In Ruby 1.9 the Generator library has been removed in favor of Fibers.
See here and here.
The library you are using is not compatible with Ruby 1.9. You can try to copy the Generator and SyncEnumerator files from Ruby 1.8.x, but I don't know whether this solution will work.
in 1.9 there's Enumerator::Generator
or you might be able to get away with creating your own file
'generator'
that just does
Generator = Enumerator
GL.
-r
I had this problem with ruby 1.8 and found that my problem was that i was requiring 'generator' and that changing it to require 'generator.rb' fixed it. I believe this was because of a conflict in rails with its own Generator class
SyncEnumerator has moved to rexml/syncenumerator in Ruby 1.9.x you can use it by doing require 'rexml/syncenumerator'