gem 'rails', '3.0.0'
gem 'devise'
gem 'bson_ext', '>= 1.0.7'
gem 'bson', '>= 1.0.7'
gem 'mongo_mapper', :branch => 'rails3', :git => 'http://github.com/jnunemaker/mongomapper.git'
gem 'devise-mongo_mapper', :git => 'git://github.com/collectiveidea/devise-mongo_mapper'
With the above setup I get the following errors on requests:
Started GET "/users/sign_out" for 127.0.0.1 at 2010-09-27 13:16:30 +0300
Processing by Devise::SessionsController#destroy as HTML
Redirected to http://localhost:3000/
Completed 302 Found in 19ms
[2010-09-27 13:16:31] ERROR Errno::ECONNRESET: Connection reset by peer
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
/usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Started GET "/users/edit" for 127.0.0.1 at 2010-09-27 13:16:35 +0300
Processing by Devise::RegistrationsController#edit as HTML
Completed in 16ms
[2010-09-27 13:16:35] ERROR Errno::ECONNRESET: Connection reset by peer
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
/usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
The user model:
class User
include MongoMapper::Document
plugin MongoMapper::Devise
devise :registerable, :database_authenticatable, :recoverable
end
Ideas?
WebRick has been replaced with Thin.
Doing the following worked for me:
Gemfile:
gem 'thin'
Now do bundle install
My quick guess is this looks like you have a problem with your sessions and protect_from_forgery is kicking in.
I had a similar problem and smashed my head against the wall for a few days, it turned out to be I was assigning an entire object to a session object instead of just the id. A quick note, non-GET requests are the ones that trigger the protect_from_forgery.
Adding this to my development.rb file fixed the issue.
config.assets.raise_runtime_errors = true
config.web_console.whitelisted_ips = replace_this_with_the_public_ip
Related
I want to use guard to run my bacon tests, my Gemfile looks like:
source 'https://rubygems.org'
gem 'sinatra'
gem 'sidekiq'
gem 'slim'
gem 'puma'
gem 'nokogiri'
gem 'httparty'
group :test, :development do
gem 'guard'
gem 'bacon'
gem 'guard-bacon'
gem 'libnotify'
gem 'rb-inotify'
end
My Guardfile looks like
# parameters:
# output => the formatted to use
# backtrace => number of lines, nil = everything
guard 'bacon', :output => "BetterOutput", :backtrace => 4 do
watch(%r{^lib/(.+)\.rb$}) { |m| "specs/lib/#{m[1]}_spec.rb" }
watch(%r{specs/.+\.rb$})
end
When I run guard the following happens
$ guard
Bacon: Using output BetterOutput.
Bacon: Limiting backtrace to 4 lines.
09:02:05 - INFO - Guard uses Libnotify to send notifications.
09:02:05 - INFO - Guard uses TerminalTitle to send notifications.
09:02:05 - INFO - Guard is now watching at '/home/martin/code/jse-api'
Guard::Bacon started.
[1] guard(main)> %
$
It seems to load everything, get to the guard prompt and exit.
I have no idea why?
The issue seems to the version of guard required by guard-bacon 1.1.0
If you force it to the latest version of guard
gem 'guard', '>= 1.8.0'
It falls back to a older version of guard-bacon 1.0.5 and everything works.
I'm building a rails app and using Spork/Guard/Rspec for testing.
I'm on a mac (10.6.8) -- here are the gems I'm using:
gem "rspec-rails", "~> 2.12.1"
gem "guard-rspec", "~> 2.3.3"
gem "guard-spork", "~> 1.4.1"
gem "spork", "~> 0.9.2"
gem 'rb-fsevent', '~> 0.9.1', :require => false
gem "growl", "~> 1.0.3"
gem 'capybara', '1.1.2'
When I edit my routes file it should restart the spork server here's the line in my Guardfile:
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' }, :foreman => true do
watch('config/routes.rb')
end
But recently I just started getting the following error when I add a new route:
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Address already in use - bind(2) (Errno::EADDRINUSE)
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:861:in `initialize'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:861:in `open'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:861:in `open_server'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:759:in `block in open_server'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:757:in `each'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:757:in `open_server'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:1342:in `initialize'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:1624:in `new'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:1624:in `start_service'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/server.rb:29:in `listen'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/server.rb:20:in `run'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/runner.rb:75:in `run'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/runner.rb:10:in `run'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/bin/spork:10:in `<top (required)>'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/bin/spork:23:in `load'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/bin/spork:23:in `<main>'
Usually when spork boots up I get the following:
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Spork is ready and listening on 8989!
How do I avoid this error?
I came here suffering the same problem as the OP.
After going down the rabbit hole of the 'error is a bug' post, and examining the line of code where the failure occurred, I rebooted out of frustration. I realized after doing this that the lock on the port likely came from the fact that I had logged out of the previous desktop session, and that the Spork DRb server hangs RubyMine on closing, so maybe that is what leaves the port open.
Sure enough, I could now start the Spork server.
I add this so other people facing this problem can consider if it matches their situation.
By removing the :foreman => true in the Guardfile I was able to get rid of this problem. Right now I'm not making meaningful use of the values in my .env file in my tests so that should be fine, but I'm submitting an issue on Github.
Looks like this error is a bug: https://github.com/rails/rails/pull/8812
I have got trouble to bundle gems from git private repositories :
gem 'test', :git => 'git://github.com/my_account/test.git'
myapp_folder$ bundle --verbose
Fetching git://github.com/my_account/test.git
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git://github.com/my_account/test.git' "/Library/Ruby/Gems/1.8/cache/bundler/git/test-7b1f0bd821d503c9d6d421d89c56850dad44c15a" --bare --no-hardlinks` in directory /Users/.../myapp_forlder has failed.
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:583:in `git'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:652:in `cache'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:550:in `specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:356:in `converge_locked_specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:345:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:345:in `converge_locked_specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:143:in `resolve'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:90:in `specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:85:in `resolve_remotely!'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:43:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/bin/bundle:13
/usr/bin/bundle:19:in `load'
/usr/bin/bundle:19
It work perfectly with push/pull/whatever the private clone it-self.
It work perfectly with bundling my public github repository.
I'm on Mac OS with bundle v 1.0.18
I also try to make some git clone my_private_repo, and it's asking me my account password. Is it normal or it should look at my ssh config and look I already have rights to access.
May be it is the point, but I don't know, how to dig further in this issue.
Use the "SSH" or "HTTP" URLs to your private repo. For example:
# HTTP (I've found this to be more reliable)
gem 'test', :git => 'https://my_account#github.com/my_account/test.git'
# SSH
gem 'test', :git => 'git#github.com:my_account/test.git'
Don't guess them, though. You can get them by going to your github repo page... there are three options at the top.
It's normal to enter a password if it asks.
add this in your ~/.gitconfig
[url "https://"]
insteadOf =git://
I'm getting a 'no such file' error when I try to require some gems in a rails console. Strangely, I don't get this error when requiring them in irb.
Thanks in advance.
$ irb
irb(main):001:0> $LOAD_PATH
=> ["/usr/local/lib/site_ruby/1.9.1", "/usr/local/lib/site_ruby/1.9.1/x86_64-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.9.1", "/usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.9.1", "/usr/lib/ruby/1.9.1/x86_64-linux"]
irb(main):002:0> require 'rubygems'
=> true
irb(main):003:0> require 'image_science'
=> true
irb(main):004:0> require 'mini_magick'
=> true
irb(main):005:0>
$ rails console
Loading development environment (Rails 3.0.5)
irb(main):001:0> require 'rubygems'
=> nil
irb(main):002:0> require 'image_science'
LoadError: no such file to load -- image_science
from /var/lib/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
...
from script/rails:6:in `require'
from script/rails:6:in `<main>'
irb(main):003:0> require 'mini_magick'
LoadError: no such file to load -- mini_magick
from /var/lib/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
...
from script/rails:6:in `require'
from script/rails:6:in `<main>'
irb(main):004:0> $LOAD_PATH
=> ["/var/lib/gems/1.9.1/gems/haml-3.0.25/vendor/fssm/lib", "/home/username/appname/lib", "/home/username/appname/vendor", "/home/username/appname/app/models", "/home/username/appname/app/mailers", "/home/username/appname/app/helpers", "/home/username/appname/app/controllers", "/var/lib/gems/1.9.1/gems/rails-3.0.5/lib", "/var/lib/gems/1.9.1/gems/railties-3.0.5/lib", "/var/lib/gems/1.9.1/gems/thor-0.14.6/lib", "/var/lib/gems/1.9.1/gems/pg-0.10.1/lib", "/var/lib/gems/1.9.1/gems/pg-0.10.1/ext", "/var/lib/gems/1.9.1/gems/oauth2-0.1.1/lib", "/var/lib/gems/1.9.1/gems/multi_json-0.0.5/lib", "/var/lib/gems/1.9.1/gems/haml-3.0.25/lib", "/var/lib/gems/1.9.1/gems/faraday-0.5.7/lib", "/var/lib/gems/1.9.1/gems/multipart-post-1.1.0/lib", "/var/lib/gems/1.9.1/gems/addressable-2.2.4/lib", "/var/lib/gems/1.9.1/gems/activeresource-3.0.5/lib", "/var/lib/gems/1.9.1/gems/activerecord-3.0.5/lib", "/var/lib/gems/1.9.1/gems/arel-2.0.9/lib", "/var/lib/gems/1.9.1/gems/actionmailer-3.0.5/lib", "/var/lib/gems/1.9.1/gems/mail-2.2.15/lib", "/var/lib/gems/1.9.1/gems/treetop-1.4.9/lib", "/var/lib/gems/1.9.1/gems/polyglot-0.3.1/lib", "/var/lib/gems/1.9.1/gems/mime-types-1.16/lib", "/var/lib/gems/1.9.1/gems/actionpack-3.0.5/lib", "/var/lib/gems/1.9.1/gems/tzinfo-0.3.24/lib", "/var/lib/gems/1.9.1/gems/rack-test-0.5.7/lib", "/var/lib/gems/1.9.1/gems/rack-mount-0.6.13/lib", "/var/lib/gems/1.9.1/gems/rack-1.2.1/lib", "/var/lib/gems/1.9.1/gems/erubis-2.6.6/lib", "/var/lib/gems/1.9.1/gems/activemodel-3.0.5/lib", "/var/lib/gems/1.9.1/gems/i18n-0.5.0/lib", "/var/lib/gems/1.9.1/gems/builder-2.1.2/lib", "/var/lib/gems/1.9.1/gems/activesupport-3.0.5/lib", "/var/lib/gems/1.9.1/gems/abstract-1.0.0/lib", "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib", "/var/lib/gems/1.9.1/gems/bundler-1.0.10/lib", "/usr/local/lib/site_ruby/1.9.1", "/usr/local/lib/site_ruby/1.9.1/x86_64-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.9.1", "/usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.9.1", "/usr/lib/ruby/1.9.1/x86_64-linux", "/var/lib/gems/1.9.1/gems/actionpack-3.0.5/lib/action_controller/vendor/html-scanner", "/var/lib/gems/1.9.1/gems/rack-mount-0.6.13/lib/rack/mount/vendor/multimap", "/var/lib/gems/1.9.1/gems/rack-mount-0.6.13/lib/rack/mount/vendor/regin"]
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'pg'
gem 'oauth2'
gem 'haml'
You cannot require gems in Rails that are not in your Gemfile. You have to either include them in your Gemfile, or specify the full path to the gem when requiring, e.g. require "/full/path/to/gem".
This is because of the way Bundler works and overrides your existing load path. If you run $LOAD_PATH in the Rails console you'll see that it differs significantly from the one in IRB.
I'm trying to deploy a simple skeleton Rails 3.0.5 (and Ruby 1.9.2) app to Heroku, but encounter the same error when I open the website and when I try to migrate the db. I created the Heroku app with heroku create --stack bamboo-mri-1.9.2. Everything works locally.
Code: https://github.com/curiousyogurt/SEE
App: http://stormy-ice-778.heroku.com/
When going to the website, I get an "Application Error"; in the logs, I get the following error (followed by lots of other information):
2011-03-20T17:25:31-07:00 app[web.1]: /app/cfde9dd3-c394-45fb-a0ef-72a753e83909/home/.bundle/gems/ruby/1.9.1/gems/railties-3.0.5/lib/rails/railtie/configuration.rb:77:in 'method_missing': undefined method `action' for #<Rails::Application::Configuration:0x00000001d398d8> (NoMethodError)
Stack Trace: gist.github.com/878866
When doing heroku rake db:migrate, I get the following error:
rake aborted!
undefined method 'action' for #
/app/44666f97-ad08-444e-9f39-9ca7eb8fdc93/home/.bundle/gems/ruby/1.9.1/gems/railties-3.0.5/lib/rails/railtie/configuration.rb:77:in `method_missing'
Stack Trace: gist.github.com/878870
Here is my Gemfile (non-production parts removed):
gem 'rails', '3.0.5'
gem 'haml'
gem 'devise', :git => 'git://github.com/plataformatec/devise',
:branch => 'master'
gem 'omniauth'
I'm not sure where to go next in trying to track down this problem. Any suggestions would be greatly appreciated.
config.action.mailer.default_url_options = { :host => 'stormy-ice-778.heroku.com' }
in your config/environments/production.rb should be
config.action_mailer.default_url_options = { :host => 'stormy-ice-778.heroku.com' }
(change action.mailer to action_mailer).