Devise Invitable LoadError - ruby-on-rails

Problem:
m#m-Lenovo-IdeaPad-Y470:~/Dropbox/software/Rails/CIRCAR_CP_NEW$ rails s
Initialize SymmetricEncryption module.
=> Booting Thin
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config/initializers/registrations.rb:1:in `<top (required)>': cannot load such file -- devise_invitable/controllers/registrations (LoadError)
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/engine.rb:587:in `each'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config/environment.rb:7:in `<top (required)>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config.ru:3:in `block in <main>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config.ru:in `new'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config.ru:in `<main>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/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>'
If I run any rake commands, the same thing happens. All my other rails applications work just fine. It's just this one (the one I didn't write) that won't start.
I see that the problem is here: CIRCAR_CP_NEW/config/initializers/registrations.rb:1
CIRCAR_CP_NEW/config/initializers/registrations.rb
module DeviseInvitable::Controllers::Registrations
def self.included(controller)
controller.send :around_filter, :keep_invitation_info, :only => :create
end
...
yield
reset_invitation_info
end if resource_invitable
puts "Keep Invitation Info End"
puts "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
end
I just have no idea what to do about it. My understanding is that Rails is looking for something in this directory
devise_invitable/controllers/registrations
but is not finding it because that directory does not exist. Apparently the code works for the developers in India but they don't feel inclined to help me figure out why it's not running on my machine.
I'm running Ubuntu 12.04
Gemfile:
gem 'devise'
gem 'devise_invitable'
Bundle Install
m#m-Lenovo-IdeaPad-Y470:~/Dropbox/software/Rails/CIRCAR_CP_NEW$ bundle install
Using rake (10.0.4)
...
Using devise (2.2.4)
Using devise_invitable (1.1.8)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Are you certain that you have the devise gems are:
e.g.
bundle install
EDIT: If we know that the gems have been downloaded, there may be a problem with the Gem's configured load paths.
Within irb or pry run Gem.path
Check each of the returned paths for the devise libraries. If the devise directory structure is not found, we have found your problem.

It was a gem compatibility issue.
After version 1.1.4, the structure of devise_invitable changed.
devise_invitable/controllers/registrations
no longer exists. Therefore
module DeviseInvitable::Controllers::Registrations
needed to change to
module DeviseInvitable::RegistrationsControllers
to reflect the structure of the updated gem.
The other solution would be to add the version number to the gemfile and make sure I am using a compatible version so that things are being referenced as expected.
The server and rake commands now run, but there are a number of other issues I have to figure out now :P

Related

Error while installing gem in Ruby on Rails project

I created a simple web project in ROR - postgresql as a DB
C:\Sites\nested>ruby -v
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
C:\Sites\nested>rails -v
Rails 4.0.2
When I try to add an automatic foreign key either by command line
C:\Sites\nested>gem install automatic_foreign_key
or edit the gem file by adding
# create automatic foreign key
gem "automatic_foreign_key", "~> 1.3.0"
I got the following error when running the server
C:\Sites\nested>rails s
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `to_sql' for class `ActiveRecord::ConnectionAdapters::Tab leDefinition' (NameError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core/active_record/connection_adapters/table_definition.rb:9:in `block in included'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core/active_record/connection_adapters/table_definition.rb:6:in `class_eval'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core/active_record/connection_adapters/table_definition.rb:6:in `included'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core.rb:32:in `include'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core.rb:32:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/automatic_foreign_key-.3.0/lib/automatic_foreign_key.rb:5:in `rescue in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/automatic_foreign_key-.3.0/lib/automatic_foreign_key.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:72:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:70:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:70:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:59:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:59:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler.rb:132:in require'
from C:/Sites/nested/config/application.rb:7:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:74:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:71:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
FYI this is your error:
`alias_method': undefined method `to_sql' for class `ActiveRecord::ConnectionAdapters::Tab leDefinition' (NameError)
Looks like the gem is creating an alias_method for .to_sql. Alias method basicaly calls a method by another name, so you can use it in different contexts
We use alias_method :name, :title a lot, because we standardize our validations, meaning we need to keep the same method names each time
Error
The actual error is caused by your class not having the to_sql method. I've never encountered this, so I looked it up:
Seems the issue is caued by Rails 4. As for a solution, I would suggest that since automatic_foreign_key hasn't been updated since 2011, it's going to be incompatible with Rails 4
If we take that idea as the problem, maybe you could detail how you want it to work & we could create a work-around?
try this
C:\Sites\nested>gem install --local automatic_foreign_key
and also bundle install --local in your project terminal and then edit gem "automatic_foreign_key", "~> 1.3.0" in your gem file

How to run existing ruby on rails project in linux

I have an existing ruby on rails project on my desktop (Moovit). now i want to run this existing project on my linux. but i can't seem to run it. i dont know if im doing it right. i transferred it to my root folder then i run this code rails new Moovit -s i dont know if this is correct? It's not working and when i checked on my browser. it says hello world . the Moovit project is a website. I've created a backup in case of trouble. I also go to Moovit folder then rails s but it's not working. I also run bundle install but still not working. How should I do it?
info:
Rails 3.2.1
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
bundle show activesupport
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6
when i run
bundle install
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
cd Moovit
rails -s
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `block in require': iconv will be deprecated in the future, use String#encode instead.
=> Booting WEBrick
=> Rails 3.0.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/root/Moovit/config/initializers/wrap_parameters.rb:8:in `block in <top (required)>': undefined method `wrap_parameters' for ActionController::Base:Class (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /root/Moovit/config/initializers/wrap_parameters.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:235:in `load'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:235:in `block in load'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:235:in `load'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/engine.rb:200:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:25:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:50:in `block in run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:49:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:134:in `initialize!'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:77:in `method_missing'
from /root/Moovit/config/environment.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `require'
from /root/Moovit/config.ru:3:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:46:in `initialize'
from /root/Moovit/config.ru:1:in `new'
from /root/Moovit/config.ru:1:in `<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:35:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:35:in `parse_file'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/server.rb:162:in `app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/server.rb:248:in `wrapped_app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/server.rb:213:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands/server.rb:65:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:30:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
also how should i run it on my specific ip address? it seems that on my /var/www/html/ there's an index.html which says hello world. and my ruby on rails project is on root folder. I'm really lost. I thought when just running those commands will make it available to my server?
Go to /config/initializers/wrap_parameters.rb, comment out the previous codes and try this code
ActiveSupport.on_load(:action_controller) do
include ActionController::ParamsWrapper
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
Follow Bellow Instruction:
cd project_name
bundle install
rails s
Also which version of rails do you use for project.
Please add config/initializers/wrap_parameters.rb and the restart your server.
ActiveSupport.on_load(:action_controller) do
if self == ActionController::Base
wrap_parameters :format => [:json]
end
end

Can't start Rails server with aws-sdk gem

I've to use the aws-sdk gem in my rails application. The problem is that whenever I add it to my gemfile, the rails server does not start and gives me the following error:
$ rails s
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)
from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:127:in `load'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:108:in `load_yaml_config'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:54:in `setup'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:26:in `block in <class:Railtie>'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/psycho/Desktop/filesdroid/config/environment.rb:5:in `<top (required)>'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/psycho/Desktop/filesdroid/config.ru:3:in `block in <main>'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/psycho/Desktop/filesdroid/config.ru:in `new'
from /home/psycho/Desktop/filesdroid/config.ru:in `<main>'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
It clearly points to line 5 of my environment.rb. I've checked and there's nothing there:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
FilesDroid::Application.initialize! # Line 5
It's simply an initialize call. This doesn't happen if I remove aws-sdk from my gemfile. Help, please?
Psych is a yaml parser, and it looks like it is trying to parse an incorrectly formatted yaml file:
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)
I happen to know that the aws-sdk gem attempts to read aws credentials from config/aws.yml. Do you have a file located there and is it correctly formatted?

Rails, Sidekiq & Unicorn

I am having some problems getting Sidekiq to run on my VPS. Everything works fine locally but once I deploy I get the following error in my unicorn log:
E, [2012-09-18T21:41:19.670672 #1308] ERROR -- : uninitialized constant MailchimpWorker::Sidekiq (NameError)
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/home/deployer/production/releases/20120919013128/app/workers/mailchimp_worker.rb:3:in `<class:MailchimpWorker>'
/home/deployer/production/releases/20120919013128/app/workers/mailchimp_worker.rb:1:in `<top (required)>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/deployer/production/releases/20120919013128/config/environment.rb:5:in `<top (required)>'
config.ru:4:in `require'
config.ru:4:in `block in <main>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
Here is the contents of my worker file:
class MailchimpWorker
include Sidekiq::Worker
LIST_ID = '844161948b'
def perform(email)
Gibbon.listSubscribe id: LIST_ID, email_address: email
end
end
Any ideas as to what I'm doing wrong?
This looks like gem 'sidekiq' is missing from your Gemfile.
If it works on dev but not production, it sounds like bundler isn't loading the gem in the production environment. Which depends on what group the gem is listed in your Gemfile and also how you deploy (how do you have bundler install your gems on production?).
So, can you post your Gemfile, and also the relevant bits in your deployment scripts?
Also double check that the sidekiq procs are being started using bundle exec.
are you running unicorn inside of bundler?
bundle exec unicorn

MongoDB connection error when I try to install any gem

I am trying to run Rails 3.2.3 using gem 1.8.23, Ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin10.8.0], MongoDB 1.6.2 with MongoMapper 0.11.0 and heroku.
I am able to start the rails server and use mongoDB both on development and on heroku. But whenever I try to install anything new (bootstrap for instance) or run 'rails s' command, I get the following error (pasted below). I assume it has something to do with mongodb and or mongo mapper. I have also enclosed the config files. I've been stuck with this since couple of days and any hints or ideas are highly appreciated. Unfortunately, this is my first RoR app and hence I may sound really stupid.
Error:
new-host:talker Name$ rails g bootstrap:install
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /Users/Name/Projects/talker/config/environment.rb:12)
/Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:330:in `rescue in receive_message_on_socket': Operation failed with the following exception: connection closed (Mongo::ConnectionFailure)
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:322:in `receive_message_on_socket'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:188:in `receive_header'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:175:in `receive'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:139:in `receive_message'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:469:in `block in send_initial_query'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/util/logging.rb:36:in `instrument'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:467:in `send_initial_query'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:458:in `refresh'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:128:in `next'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/db.rb:511:in `command'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:628:in `check_is_master'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:402:in `connect'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:589:in `setup'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:114:in `initialize'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo_mapper-0.11.1/lib/mongo_mapper/connection.rb:75:in `new'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo_mapper-0.11.1/lib/mongo_mapper/connection.rb:75:in `connect'
from /Users/Name/Projects/talker/config/initializers/mogo.rb:28:in `'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:588:in `block (2 levels) in '
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:587:in `block in '
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/Name/Projects/talker/config/environment.rb:12:in `'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:103:in `require'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:103:in `require_environment!'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:25:in `'
from script/rails:6:in `require'
from script/rails:6:in `'
new-host:talker Name$
environment.rb
require File.expand_path('../application', FILE)
Talker::Application.initialize!
mongo.rb
MongoMapper.config = {
Rails.env => { 'uri' => ENV['MONGOHQ_URL'] || 'mongodb://localhost:28017' } }
MongoMapper.connect(Rails.env)
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.connection.connect if forked
end
end
Your config file says to connect to localhost:28017, but that's the web console. You probably want localhost:27017.

Resources