i can't rails s with redis-store - ruby-on-rails-3

my rails is 3.2.8
i have gem like below
#gemfile
gem 'redis', '3.0.2'
gem 'redis-store', '1.1.3'
gem 'redis-rails'
#session_store.rb
Application.config.session_store :redis_session_store
then rails s
it report error like below
=> Booting Thin
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/magicstudio/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application/configuration.rb:140:in `const_get': uninitialized constant ActionDispatch::Session::RedisSessionStore (NameError)
from /Users/magicstudio/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application/configuration.rb:140:in `session_store'
why?

Related

Installed ruby gem(NMatrix) not showing in irb

I have installed ruby gem nmatrix with the command below:
sudo gem install nmatrix
I have installed it in ubuntu 12.04 . My gem env is as below:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.25
- RUBY VERSION: 1.9.3 (2013-05-15 patchlevel 429) [i686-linux]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p429
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p429/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/local/rvm/gems/ruby-1.9.3-p429
- /usr/local/rvm/gems/ruby-1.9.3-p429#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.github.com/", "http://rubygems.org"]
- REMOTE SOURCES:
- http://gems.github.com/
- http://rubygems.org
Now when I go to irb and run code as below,to use NMatrix it gives error as :
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'nmatrix'
LoadError: cannot load such file -- nmatrix
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):2
from /usr/local/rvm/rubies/ruby-1.9.3-p429/bin/irb:13:in `<main>'
irb(main):003:0>
So what should I do to use nMatrix gem I just installed. Also when i do
gem list
It is not showing nmatrix gem.
Doing
sudo gem list
only shows nmatrix gem.
Thanks.

Guard starts then exits?

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.

thinking_shpinx, sphinx and MacOS X 10.6.7

After installing thinking_sphinx (http://freelancing-god.github.com/ts), and Sphinx (via brew - v.0.9.9-release (r2117) or via latest sources) and setting up ts in Rails3 (Ruby via RVM: ruby-1.9.2-p180 [ x86_64 ], rails 3.0.7) app like:
define_index do
indexes :name
end
and executing rake ts:start or rake ts:index, i permanently get:
ruby: invalid option -/ (-h will show valid options) (RuntimeError)
What the problem?

Heroku Deployment and DB Migration Issue

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).

ERROR Errno::ECONNRESET: Connection reset by peer

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