Rails (3.2.16) Routing Error uninitialized constant InheritedResources - ruby-on-rails

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?

Related

Errbit LDAP Authentication not working

I'm trying to install errbit to track bugs more easily.
I followed the Installation Instructions from:
https://github.com/errbit/errbit
and
Installed the LDAP Authentication gem:
Gemfile:
gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git"
executed:
rails generate devise_ldap_authenticatable:install
So far everything went good. The Unicorn Application Server starts without any issues.
But If I login I get this message:
Problem:
Validation of User failed.
Summary:
The following errors were found: Email can't be blank, Name can't be blank
Resolution:
Try persisting the document with valid data or remove the validations.
Stack Trace:
mongoid (3.1.5) lib/mongoid/persistence.rb:335:in `fail_validate!'
mongoid (3.1.5) lib/mongoid/persistence.rb:97:in `save!'
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/devise_ldap_authenticatable-350b78431dbf/lib/devise_ldap_authenticatable/model.rb:107:in `find_for_ldap_authentication'
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/devise_ldap_authenticatable-350b78431dbf/lib/devise_ldap_authenticatable/strategy.rb:7:in `authenticate!'
warden (1.2.3) lib/warden/strategies/base.rb:53:in `_run!'
warden (1.2.3) lib/warden/proxy.rb:354:in `block in _run_strategies_for'
warden (1.2.3) lib/warden/proxy.rb:349:in `each'
warden (1.2.3) lib/warden/proxy.rb:349:in `_run_strategies_for'
warden (1.2.3) lib/warden/proxy.rb:319:in `_perform_authentication'
warden (1.2.3) lib/warden/proxy.rb:104:in `authenticate'
devise (3.1.1) lib/devise/controllers/helpers.rb:56:in `current_user'
devise (3.1.1) lib/devise/controllers/helpers.rb:52:in `user_signed_in?'
app/controllers/application_controller.rb:49:in `set_time_zone'
activesupport (3.2.18) lib/active_support/callbacks.rb:484:in `_run__372840598407275581__process_action__1401166438855027473__callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.18) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.18) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.18) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.18) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
actionpack (3.2.18) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.18) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.18) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.18) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.18) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.18) lib/action_dispatch/routing/mapper.rb:43: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.18) lib/action_dispatch/routing/route_set.rb:608:in `call'
rack-ssl-enforcer (0.2.6) lib/rack/ssl-enforcer.rb:51:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/rack.rb:27:in `call'
mongoid (3.1.5) lib/rack/mongoid/middleware/identity_map.rb:34:in `block in call'
mongoid (3.1.5) lib/mongoid/unit_of_work.rb:39:in `unit_of_work'
mongoid (3.1.5) lib/rack/mongoid/middleware/identity_map.rb:34: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 `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.18) 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:35:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.18) 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.18) lib/action_dispatch/middleware/cookies.rb:341:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `_run__2041107628848191489__call__2819675434513924104__callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
rack (1.4.5) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.18) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.18) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.18) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.18) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.18) 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.18) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:143:in `pass'
rack-cache (1.2) lib/rack/cache/context.rb:155:in `invalidate'
rack-cache (1.2) lib/rack/cache/context.rb:71:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/user_informer.rb:12:in `call'
railties (3.2.18) lib/rails/engine.rb:484:in `call'
railties (3.2.18) lib/rails/application.rb:231:in `call'
railties (3.2.18) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.4.5) lib/rack/deflater.rb:13:in `call'
unicorn (4.6.3) lib/unicorn/http_server.rb:552:in `process_client'
unicorn (4.6.3) lib/unicorn/http_server.rb:632:in `worker_loop'
unicorn (4.6.3) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
unicorn (4.6.3) lib/unicorn/http_server.rb:142:in `start'
unicorn (4.6.3) bin/unicorn_rails:209:in `<top (required)>'
/usr/local/bin/unicorn_rails:23:in `load'
/usr/local/bin/unicorn_rails:23:in `<main>'
Request Parameters
{"utf8"=>"✓",
"authenticity_token"=>"0000000000000000000000000000000000000000",
"user"=>{"username"=>"chris",
"password"=>"[FILTERED]",
"remember_me"=>"0"}}
What did I do wrong?
Update:
It works now so far.
But I'm still gitting one more Issue:
Mongoid::Errors::Validations (
Problem:
Validation of User failed.
Summary:
The following errors were found: Name can't be blank
Resolution:
Try persisting the document with valid data or remove the validations.):
app/controllers/application_controller.rb:48:in `set_time_zone'
I tried to remove the LDAP Validation, but that also didn't work.
sorry if this answer comes too late. Here's what I did to get a working LDAP setup.
In app/models/users.rb I added the following method:
def ldap_before_save
name = Devise::LDAP::Adapter.get_ldap_param(self.username, "givenName")
surname = Devise::LDAP::Adapter.get_ldap_param(self.username, "sn")
mail = Devise::LDAP::Adapter.get_ldap_param(self.username, "mail")
self.name = (name + surname).join ' '
self.email = mail.first
end
In config/initializers/devise.rb, set the following params
config.ldap_create_user = true
config.ldap_use_admin_to_bind = true
Create a new file config/initializers/devise_ldap.rb with the following contents:
Errbit::Config.devise_modules << :ldap_authenticatable
For more details, read https://github.com/errbit/errbit#configuring-ldap-authentication

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'

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'

Completed 500 Internal Server Error; RestClient::NotAcceptable (406 Not Acceptable)

I'm pretty new in Rails and on stackoverflow so I'll try to be explicite.
I was asking to change someone project, so I get the sources and try to make it works on
my own work computer (that's on Windows ...) to test it on my local browser (cf : rails s). The project is suppose to be working because it's already in production, so I assume that the problem come from my own work environment.
After installing all the needed gems, run bundle install and launch database serveur (the project is using mongodb), I run rails server. The command actually works but as soon as I try to connect on the application with any browser on the localhost adress (http://localhost:3000/) I get an error and I reaaly don't understand the cause...
This is the log I get :
Started GET "/" for 127.0.0.1 at 2012-12-04 14:51:30 +0100
Processing by HomeController#index as HTML
** [Localeapp] 1354629090-- Handling translation updates
** [Localeapp] 1354629090 - polling
** [Localeapp] API CALL: get https://api.localeapp.com/v1/projects/hhMxHgKAzj9p1dFuS0GnTTnemJ5F9dXLDuCa1KacQSymUcmTFk/translations.yml?updated_at=1354612995
** [Localeapp] ATTEMPT 1
Completed 500 Internal Server Error in 1192ms
RestClient::NotAcceptable (406 Not Acceptable):
rest-client (1.6.7) lib/restclient/abstract_response.rb:48:in `return!'
rest-client (1.6.7) lib/restclient/request.rb:230:in `process_result'
rest-client (1.6.7) lib/restclient/request.rb:178:in `block in transmit'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:745:in `start'
rest-client (1.6.7) lib/restclient/request.rb:172:in `transmit'
rest-client (1.6.7) lib/restclient/request.rb:64:in `execute'
rest-client (1.6.7) lib/restclient/request.rb:33:in `execute'
localeapp (0.5.2) lib/localeapp/api_caller.rb:66:in `make_call'
localeapp (0.5.2) lib/localeapp/api_caller.rb:28:in `call'
localeapp (0.5.2) lib/localeapp/api_call.rb:6:in `api_call'
localeapp (0.5.2) lib/localeapp/poller.rb:43:in `poll!'
localeapp (0.5.2) lib/localeapp/rails/controller.rb:14:in `handle_translation_updates'
activesupport (3.2.3) lib/active_support/callbacks.rb:429:in `_run__744959596__process_action__507377612__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.3) 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.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
omniauth (1.1.1) lib/omniauth/builder.rb:48:in `call'
mongoid (2.5.0) lib/rack/mongoid/middleware/identity_map.rb:33:in `block in call'
mongoid (2.5.0) lib/mongoid.rb:133:in `unit_of_work'
mongoid (2.5.0) lib/rack/mongoid/middleware/identity_map.rb:33:in `call'
sass (3.2.1) lib/sass/plugin/rack.rb:54: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.3) 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.3) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.3) 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.3) lib/action_dispatch/middleware/cookies.rb:338:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__286698992__call__202403334__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.1) lib/quiet_assets.rb:20:in `call_with_quiet_assets'
actionpack (3.2.3) 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.3) 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.3) lib/action_dispatch/middleware/static.rb:62:in `call'
airbrake (3.1.4) lib/airbrake/rack.rb:41:in `call'
airbrake (3.1.4) lib/airbrake/user_informer.rb:12:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.4.1) lib/rack/deflater.rb:13:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
thin (1.4.1) lib/thin/connection.rb:80:in `block in pre_process'
thin (1.4.1) lib/thin/connection.rb:78:in `catch'
thin (1.4.1) lib/thin/connection.rb:78:in `pre_process'
thin (1.4.1) lib/thin/connection.rb:53:in `process'
thin (1.4.1) lib/thin/connection.rb:38:in `receive_data'
eventmachine-1.0.0-x86 (mingw32) lib/eventmachine.rb:187:in `run_machine'
eventmachine-1.0.0-x86 (mingw32) lib/eventmachine.rb:187:in `run'
thin (1.4.1) lib/thin/backends/base.rb:63:in `start'
thin (1.4.1) lib/thin/server.rb:159:in `start'
rack (1.4.1) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.3) lib/rails/commands/server.rb:70:in `start'
railties (3.2.3) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.3) lib/rails/commands.rb:50:in `tap'
railties (3.2.3) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (4.0ms)
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.0ms)
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (56.0ms)
And this is the controller that's mentionned :
class HomeController < ApplicationController
def index
#presenter = Home::IndexPresenter.new
#article_presenter = Articles::IndexPresenter.new(Article.with_state(:published).last)
end
end
If someone could help me it would be very kind. Ask if I forgot to mention something.
Thanks you.
The root problem is that the URL being requested by rest_client is returning the HTTP 406 code, which you can see by running curl, e.g.
curl --include https://api.localeapp.com/v1/projects/hhMxHgKAzj9p1dFuS0GnTTnemJ5F9dXLDuCa1KacQSymUcmTFk/translations.yml?updated_at=1354612995
(I just noticed that you are on a windows environment -- if you don't have access to curl there are several tools you can install that will allow you to make requests)
Then, within your controller, there doesn't appear to be any check to see if the response from the RestClient call was successful (2xx status) or not. Because RestClient raises an exception, you get a 500 error in your application.
So, if you're not sure why the URL is not working, then you'll need to check the API provided by localeapp.com
But given that the API is an external service, you may also want to add some error handling within your software. There are several things out there known as RestClient, but if it's by archiloque, the documentation provides a good example of "result handling" here.

is this route possible?

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

Resources