Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `clean' for #<Hash> 5.0.0.beta1 #22846

Closed
pacMakaveli opened this issue Dec 30, 2015 · 1 comment
Closed

undefined method `clean' for #<Hash> 5.0.0.beta1 #22846

pacMakaveli opened this issue Dec 30, 2015 · 1 comment

Comments

@pacMakaveli
Copy link

@pacMakaveli pacMakaveli commented Dec 30, 2015

Hello!

Sorry if this has been reported already, I did search with no luck.
Anywho..

Rails 5.0.0.beta1 gives this undefined method instead of, I'm guessing, what should be undefined method for nil

  def show
    if params[:id].nil?
      @user = current_user
    else
      set_user
    end

    @games = @user.games
  end

  ...

  def set_user
    @user = User.find(params[:id])
  end

The problem is that Devise doesn't sign me up and thus there is no current_user, but I would expect the @user to return nil, instead of this cryptic error.

    Extracted source (around line #118):
    def clean_backtrace(*args)
      if backtrace_cleaner
        backtrace_cleaner.clean(backtrace, *args)
      else
        backtrace
      end
  constraints subdomain: 'my' do
    get '/', to: 'users#show', as: 'app_root'

    resources :users
/users/1 - works!
/ - which should be users#show doesn't work

This is my stacktrace.

Started GET "/" for 127.0.0.1 at 2015-12-30 09:02:53 +0000
Processing by UsersController#show as HTML
  Parameters: {"subdomain"=>"my"}
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)

NoMethodError (undefined method `clean' for #<Hash:0x007fb8fd853a50>):
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/exception_wrapper.rb:118:in `clean_backtrace'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/exception_wrapper.rb:52:in `application_trace'
  meta_request (0.3.4) lib/meta_request/event.rb:19:in `events_for_exception'
  meta_request (0.3.4) lib/meta_request/middlewares/app_request_handler.rb:17:in `rescue in call'
  meta_request (0.3.4) lib/meta_request/middlewares/app_request_handler.rb:24:in `call'
  meta_request (0.3.4) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
  actionview (5.0.0.beta1) lib/action_view/digestor.rb:14:in `call'
  warden (1.2.4) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.4) lib/warden/manager.rb:34:in `catch'
  warden (1.2.4) lib/warden/manager.rb:34:in `call'
  rack (2.0.0.alpha) lib/rack/etag.rb:25:in `call'
  rack (2.0.0.alpha) lib/rack/conditional_get.rb:25:in `call'
  rack (2.0.0.alpha) lib/rack/head.rb:12:in `call'
  rack (2.0.0.alpha) lib/rack/session/abstract/id.rb:220:in `context'
  rack (2.0.0.alpha) lib/rack/session/abstract/id.rb:214:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/cookies.rb:608:in `call'
  activerecord (5.0.0.beta1) lib/active_record/query_cache.rb:36:in `call'
  activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:963:in `call'
  activerecord (5.0.0.beta1) lib/active_record/migration.rb:524:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:90:in `run_callbacks'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/reloader.rb:71:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
  rack-contrib (1.2.0) lib/rack/contrib/response_headers.rb:17:in `call'
  meta_request (0.3.4) lib/meta_request/middlewares/headers.rb:16:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
  railties (5.0.0.beta1) lib/rails/rack/logger.rb:42:in `call_app'
  railties (5.0.0.beta1) lib/rails/rack/logger.rb:24:in `block in call'
  activesupport (5.0.0.beta1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
  activesupport (5.0.0.beta1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (5.0.0.beta1) lib/active_support/tagged_logging.rb:70:in `tagged'
  railties (5.0.0.beta1) lib/rails/rack/logger.rb:24:in `call'
  request_store (1.2.1) lib/request_store/middleware.rb:8:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
  rack (2.0.0.alpha) lib/rack/method_override.rb:22:in `call'
  rack (2.0.0.alpha) lib/rack/runtime.rb:22:in `call'
  activesupport (5.0.0.beta1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/load_interlock.rb:13:in `call'
  actionpack (5.0.0.beta1) lib/action_dispatch/middleware/static.rb:132:in `call'
  rack (2.0.0.alpha) lib/rack/sendfile.rb:111:in `call'
  railties (5.0.0.beta1) lib/rails/engine.rb:522:in `call'
  puma (2.15.3) lib/puma/server.rb:541:in `handle_request'
  puma (2.15.3) lib/puma/server.rb:388:in `process_client'
  puma (2.15.3) lib/puma/server.rb:270:in `block in run'
  puma (2.15.3) lib/puma/thread_pool.rb:106:in `call'
  puma (2.15.3) lib/puma/thread_pool.rb:106:in `block in spawn_thread'


  Rendered /Users/vladsmarteditors/.rvm/gems/ruby-2.2.3/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.3ms)
  Rendered /Users/vladsmarteditors/.rvm/gems/ruby-2.2.3/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.8ms)
  Rendered /Users/vladsmarteditors/.rvm/gems/ruby-2.2.3/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.1ms)
  Rendered /Users/vladsmarteditors/.rvm/gems/ruby-2.2.3/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (63.8ms)
@pacMakaveli pacMakaveli changed the title undefined method `clean' for #<Hash> undefined method `clean' for #<Hash> 5.0.0.beta1 Dec 30, 2015
@rafaelfranca

This comment has been minimized.

Copy link
Member

@rafaelfranca rafaelfranca commented Dec 30, 2015

It is a bug in the meta_request gem that is initializing the ExceptionWrapper wrongly https://github.com/dejan/rails_panel/blob/master/meta_request/lib/meta_request/middlewares/app_request_handler.rb#L16

shamozhixing pushed a commit to shamozhixing/gitlab-ce that referenced this issue Aug 23, 2016
We were initializing the ExceptionWrapper incorrectly since it changed in Rails 5.

See the Rails Issue and related fix in another gem:

- rails/rails#22846
- dejan/rails_panel@3bdbfc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.