is this route possible? - ruby-on-rails

hi im new in ruby on rails development and currently im working in a reservation system i made a semi static page with a controller inside it has a functionroom action
my functionroom action is
def functionroom
#reservation = Reservation.find(params[:reservation_id])
#function_room = FunctionRoom.all
end
but when i try to route to functionroom coming from the reservation module with this route
<%= link_to "add functionrooms", reservation_pages_functionroom_path(#reservation) %>
it gives me a uninitialized constant Reservations error
im just wondering if im working with my routes right dealing with the pages/functionroom static page.
resources :reservations do
resources :reservation_function_rooms
resources :reservation_packages
get 'pages/functionroom'
resources :package_line_items
end
error stack:
ActionController::RoutingError (uninitialized constant Reservations):
activesupport (3.2.1) lib/active_support/inflector/methods.rb:229:in
`block in constantize'
activesupport (3.2.1) lib/active_support/inflector/methods.rb:228:in
`each'
activesupport (3.2.1) lib/active_support/inflector/methods.rb:228:in
`constantize'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:62:in
`controller_reference'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:47:in
`controller'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:26:in
`call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in
`call'
sass (3.1.15) lib/sass/plugin/rack.rb:54:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1)
lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1)
lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in
`call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in
`call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1)
lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in
`call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in
`block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in
`_run__321294476__call__156324443__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in
`__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in
`_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in
`run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in
`call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in
`call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in
`call'
actionpack (3.2.1)
lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1)
lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in
`call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1)
lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in
`call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/httpserver.rb:138:in
`service'
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/httpserver.rb:94:in
`run'
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/server.rb:191:in
`block in start_thread'
Rendered
/home/led/.rvm/gems/ruby-1.9.3-rc1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
within rescues/layout (1.2ms)

You can make route of it like in this way also
resources :reservations do
resources :pages do
collection do
get :functionroom
end
end
resources :reservation_function_rooms
resources :reservation_packages
resources :package_line_items
end
but you can check routes through rake routes
it will sure work........

run 'rake routes' to check your path

Check your controller name if it "reservations_controller.rb" or "reservation_controller"?
if it "reservation_controller.rb" then change it to "reservations_controller.rb"
code
class ReservationsController < ApplicationController
end

Related

Rails (3.2.16) Routing Error uninitialized constant InheritedResources

I'm in the process of upgrading a Rails 2.3 app to 3.2 - in doing so, one of the plugins I used to depend on ResourceController is no longer available in Rails 3 (at least not a good port that I've found). Thus, I've had to look to other options, each gem I've tried rc_rails and rd_resource_controller as well as inherited_resources has resulted in the same error:
Routing Error uninitialized constant [ResourceController|InheritedResources].
They are most certainly in my gemlock and I've restarted the server in testing them. It almost seems as if the gems did not install, for such an error to occur.
Here are my routes from resources :projects:
projects GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project GET /projects/new(.:format) projects#new
edit_project GET /projects/:id/edit(.:format) projects#edit
project GET /projects/:id(.:format) projects#show
PUT /projects/:id(.:format) projects#update
DELETE /projects/:id(.:format) projects#destroy
Here's the controller:
class ProjectsController < ResourceController::Base
#....
end
## OR
class ProjectsController < InheritedResources::Base
## ....
end
Which all result in the uninitialized constant:
Routing Error
uninitialized constant InheritedResources
Here's the traceback for the inherited resource:
Started GET "/projects/3903/edit" for 127.0.0.1 at 2014-01-30 10:17:55 -0600
ActionController::RoutingError (uninitialized constant InheritedResources):
app/controllers/projects_controller.rb:3:in `<top (required)>'
activesupport (3.2.16) lib/active_support/inflector/methods.rb:230:in `block in constantize'
activesupport (3.2.16) lib/active_support/inflector/methods.rb:229:in `each'
activesupport (3.2.16) lib/active_support/inflector/methods.rb:229:in `constantize'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:54:in `controller'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:32:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:608:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.16) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `_run__542093477292722009__call__814078438384904527__callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.16) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.16) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.16) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.16) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.16) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.16) lib/rails/engine.rb:484:in `call'
railties (3.2.16) lib/rails/application.rb:231:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.16) lib/rails/rack/debugger.rb:20:in `call'
railties (3.2.16) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/Users/myself/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/myself/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/myself/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Rendered /Users/myself/.rvm/gems/ruby-1.9.3-p448#myapp/gems/actionpack-3.2.16/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.6ms)
Here's the Gemfile and Gemfile.lock for inherited:
[myself]:myapp(upgrade/rails-3.2)$ cat Gemfile | grep inherited
gem 'inherited_resources'
[myself]:myapp(upgrade/rails-3.2)$ cat Gemfile.lock | grep inherited
inherited_resources (1.4.1)
inherited_resources
And the bundle show inherited_resources:
/Users/myself/.rvm/gems/ruby-1.9.3-p448#production/gems/inherited_resources-1.4.1
Why on earth would these not be available?

Active admin without devise configuration on rails mountable engine

I am currently trying to install active admin on a rails mountable engine. The host application for the engine has authentication configured using devise. I have installed active admin without devise authentication using the --skip-user option [while running rake active_admin:install]. I am mounting the engine on the host application on the path /admin_app/.
When trying to access the URL:
http://localhost:3000/admin_app/admin
I am getting the following error
ActionController::RoutingError - uninitialized constant Admin::DashboardController:
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:57:in `rescue in controller'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:52:in `controller'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:32:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/error_collector.rb:50:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/error_collector.rb:50:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/agent_hooks.rb:28:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/browser_monitoring.rb:23:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/developer_mode.rb:42:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__342236532__call__311563165__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
better_errors (1.0.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.0.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.0.1) lib/better_errors/middleware.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/home/systemone/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/systemone/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/systemone/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Routing with static pages

I have a routing problem with my static pages. It worked fine and then I added a resource production and now I can't display my static pages. I don't know if this can be related. It shows me this error: ArgumentError in StaticPagesController#home
wrong number of arguments (1 for 0)
routes.rb:
MyApp::Application.routes.draw do
resources :productions
root :to => 'static_pages#home'
match 'process', to: 'static_pages#process', via: 'get'
match 'team', to: 'static_pages#team', via: 'get'
end
static_pages_controller.rb:
class StaticPagesController < ApplicationController
def home
end
def process
end
def team
end
end
Error trace:
app/controllers/static_pages_controller.rb:6:in `process'
actionpack (3.2.13) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__2162052213471138094__call__3927030013008107255__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
I think you are overriding ActionController's internal process method.
Using a different name for your process method should work.

Ruby on Rails Type Error cant convert nil into hash

I started a new application with
rails new doctor
rake db:migrate
rails generate controller home index
rails generate scaffold Patient age:string city:string number:string street:string
after that i deletet the public index and changed the route to root :to => "home#index"
rake db:migrate
rails server
So my problem is that i become the error in the Browser:
Type error, cant convert nil into hash
I cant explain me, what should be wrong in my application! I hope somebody knows the answer! Thanks
rack (1.4.5) lib/rack/session/abstract/id.rb:28:in `merge!'
rack (1.4.5) lib/rack/session/abstract/id.rb:28:in `initialize'
rack (1.4.5) lib/rack/session/abstract/id.rb:242:in `new'
rack (1.4.5) lib/rack/session/abstract/id.rb:242:in `prepare_session'
rack (1.4.5) lib/rack/session/abstract/id.rb:209:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__759447931__call__819038987__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

mongoid and devise gives unsual error

Mongoid with devise seems to be throwing up this error for me, where ever devise is being used.
undefined method `-' for nil:NilClass
this is the stack trace
moped (1.2.7) lib/moped/cluster.rb:172:in `block in refresh'
moped (1.2.7) lib/moped/cluster.rb:179:in `each'
moped (1.2.7) lib/moped/cluster.rb:179:in `refresh'
moped (1.2.7) lib/moped/cluster.rb:132:in `nodes'
moped (1.2.7) lib/moped/cluster.rb:240:in `with_secondary'
moped (1.2.7) lib/moped/session/context.rb:104:in `with_node'
moped (1.2.7) lib/moped/session/context.rb:43:in `query'
moped (1.2.7) lib/moped/query.rb:112:in `first'
mongoid (3.0.10) lib/mongoid/contextual/mongo.rb:201:in `first'
mongoid (3.0.10) lib/mongoid/contextual.rb:18:in `first'
orm_adapter (0.4.0) lib/orm_adapter/adapters/mongoid.rb:22:in `get'
devise (2.1.2) lib/devise/models/authenticatable.rb:183:in `serialize_from_session'
devise (2.1.2) lib/devise/rails/warden_compat.rb:29:in `deserialize'
warden (1.2.1) lib/warden/session_serializer.rb:35:in `fetch'
warden (1.2.1) lib/warden/proxy.rb:212:in `user'
warden (1.2.1) lib/warden/proxy.rb:318:in `_perform_authentication'
warden (1.2.1) lib/warden/proxy.rb:127:in `authenticate!'
devise (2.1.2) lib/devise/controllers/helpers.rb:48:in `authenticate_user!'
activesupport (3.2.8) lib/active_support/callbacks.rb:418:in `_run__532752988157179990__process_action__39271927218028622__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in `call'
mongoid (3.0.10) lib/rack/mongoid/middleware/identity_map.rb:34:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__4054107343433525264__call__3237741633973160553__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Users/amit/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/amit/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/amit/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
The controller has a before_filter :authenticate_user! commenting this, allows the page to work.
What might be wrong here?
I have tried destroying all devise installs by doing
rails d devise user
rails d devise:views
rails d devise:install
and then re installing devise, it did not help. Any ideas?
Just spotted that I was using ruby 1.9.2 and it needs to be at least 1.9.3
see http://mongoid.org/en/mongoid/docs/tips.html
That has cured the problem for me.
The issue was that mongod was not running. For some reason instead of throwing a not able to connect message, rails now throws this.

Resources