NoMethodError - undefined method `all' for #<SwitchUser::GuestDataSource:0x007fd8d426f138>
Closed this issue · 3 comments
Hi,
Thanks for the gem, it's been super useful.
I started having this issue when I updated to 1.0. I'm on Rails 4.2.2, Ruby 2.2.1, Devise 3.5.1. It won't load the switch_user_select.
Thanks!
ale
Completed 500 Internal Server Error in 127ms (ActiveRecord: 0.0ms)
SwitchUser::GuestDataSource:0x007fd8d426f138>
NoMethodError - undefined method all' for #<SwitchUser::GuestDataSource:0x007fd8d426f138>: switch_user (1.0.0) lib/switch_user/data_source.rb:10:in
block in all'
switch_user (1.0.0) lib/switch_user/data_source.rb:10:in each' switch_user (1.0.0) lib/switch_user/data_source.rb:10:in
flat_map'
switch_user (1.0.0) lib/switch_user/data_source.rb:10:in all' switch_user (1.0.0) lib/switch_user.rb:41:in
all_users'
switch_user (1.0.0) app/helpers/switch_user_helper.rb:14:in switch_user_select' app/views/layouts/one-page.html.erb:29:in
_app_views_layouts_one_page_html_erb___3458226017543812090_70284626163620'
actionview (4.2.2) lib/action_view/template.rb:145:in block in render' activesupport (4.2.2) lib/active_support/notifications.rb:166:in
instrument'
actionview (4.2.2) lib/action_view/template.rb:333:in instrument' actionview (4.2.2) lib/action_view/template.rb:143:in
render'
actionview (4.2.2) lib/action_view/renderer/template_renderer.rb:66:in render_with_layout' actionview (4.2.2) lib/action_view/renderer/template_renderer.rb:52:in
render_template'
actionview (4.2.2) lib/action_view/renderer/template_renderer.rb:14:in render' actionview (4.2.2) lib/action_view/renderer/renderer.rb:42:in
render_template'
actionview (4.2.2) lib/action_view/renderer/renderer.rb:23:in render' actionview (4.2.2) lib/action_view/rendering.rb:100:in
_render_template'
actionpack (4.2.2) lib/action_controller/metal/streaming.rb:217:in _render_template' actionview (4.2.2) lib/action_view/rendering.rb:83:in
render_to_body'
actionpack (4.2.2) lib/action_controller/metal/rendering.rb:32:in render_to_body' actionpack (4.2.2) lib/action_controller/metal/renderers.rb:37:in
render_to_body'
actionpack (4.2.2) lib/abstract_controller/rendering.rb:25:in render' actionpack (4.2.2) lib/action_controller/metal/rendering.rb:16:in
render'
actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:44:in block (2 levels) in render' activesupport (4.2.2) lib/active_support/core_ext/benchmark.rb:12:in
block in ms'
/Users/alexandrethome/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/benchmark.rb:303:in realtime' activesupport (4.2.2) lib/active_support/core_ext/benchmark.rb:12:in
ms'
actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:44:in block in render' actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:87:in
cleanup_view_runtime'
activerecord (4.2.2) lib/active_record/railties/controller_runtime.rb:25:in cleanup_view_runtime' actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:43:in
render'
actionpack (4.2.2) lib/action_controller/metal/implicit_render.rb:10:in default_render' actionpack (4.2.2) lib/action_controller/metal/implicit_render.rb:5:in
send_action'
actionpack (4.2.2) lib/abstract_controller/base.rb:198:in process_action' actionpack (4.2.2) lib/action_controller/metal/rendering.rb:10:in
process_action'
actionpack (4.2.2) lib/abstract_controller/callbacks.rb:20:in block in process_action' activesupport (4.2.2) lib/active_support/callbacks.rb:117:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:117:in call' activesupport (4.2.2) lib/active_support/callbacks.rb:555:in
block (2 levels) in compile'
activesupport (4.2.2) lib/active_support/callbacks.rb:505:in call' activesupport (4.2.2) lib/active_support/callbacks.rb:505:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:498:in block (2 levels) in around' activesupport (4.2.2) lib/active_support/callbacks.rb:313:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:313:in block (2 levels) in halting' browser-timezone-rails (0.0.8) lib/browser-timezone-rails.rb:14:in
set_time_zone'
activesupport (4.2.2) lib/active_support/callbacks.rb:432:in block in make_lambda' activesupport (4.2.2) lib/active_support/callbacks.rb:312:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:312:in block in halting' activesupport (4.2.2) lib/active_support/callbacks.rb:497:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:497:in block in around' activesupport (4.2.2) lib/active_support/callbacks.rb:505:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:505:in call' activesupport (4.2.2) lib/active_support/callbacks.rb:92:in
_run_callbacks'
activesupport (4.2.2) lib/active_support/callbacks.rb:776:in _run_process_action_callbacks' activesupport (4.2.2) lib/active_support/callbacks.rb:81:in
run_callbacks'
actionpack (4.2.2) lib/abstract_controller/callbacks.rb:19:in process_action' actionpack (4.2.2) lib/action_controller/metal/rescue.rb:29:in
process_action'
actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:32:in block in process_action' activesupport (4.2.2) lib/active_support/notifications.rb:164:in
block in instrument'
activesupport (4.2.2) lib/active_support/notifications/instrumenter.rb:20:in instrument' activesupport (4.2.2) lib/active_support/notifications.rb:164:in
instrument'
actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:30:in process_action' actionpack (4.2.2) lib/action_controller/metal/params_wrapper.rb:250:in
process_action'
activerecord (4.2.2) lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (4.2.2) lib/abstract_controller/base.rb:137:in
process'
actionview (4.2.2) lib/action_view/rendering.rb:30:in process' actionpack (4.2.2) lib/action_controller/metal.rb:196:in
dispatch'
actionpack (4.2.2) lib/action_controller/metal/rack_delegation.rb:13:in dispatch' actionpack (4.2.2) lib/action_controller/metal.rb:237:in
block in action'
actionpack (4.2.2) lib/action_dispatch/routing/route_set.rb:74:in call' actionpack (4.2.2) lib/action_dispatch/routing/route_set.rb:74:in
dispatch'
actionpack (4.2.2) lib/action_dispatch/routing/route_set.rb:43:in serve' actionpack (4.2.2) lib/action_dispatch/journey/router.rb:43:in
block in serve'
actionpack (4.2.2) lib/action_dispatch/journey/router.rb:30:in each' actionpack (4.2.2) lib/action_dispatch/journey/router.rb:30:in
serve'
actionpack (4.2.2) lib/action_dispatch/routing/route_set.rb:819:in call' bullet (4.14.7) lib/bullet/rack.rb:12: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' rack (1.6.4) lib/rack/etag.rb:24:in
call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in call' rack (1.6.4) lib/rack/head.rb:13:in
call'
actionpack (4.2.2) lib/action_dispatch/middleware/params_parser.rb:27:in call' actionpack (4.2.2) lib/action_dispatch/middleware/flash.rb:260:in
call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in context' rack (1.6.4) lib/rack/session/abstract/id.rb:220:in
call'
actionpack (4.2.2) lib/action_dispatch/middleware/cookies.rb:560:in call' activerecord (4.2.2) lib/active_record/query_cache.rb:36:in
call'
activerecord (4.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in call' activerecord (4.2.2) lib/active_record/migration.rb:378:in
call'
actionpack (4.2.2) lib/action_dispatch/middleware/callbacks.rb:29:in block in call' activesupport (4.2.2) lib/active_support/callbacks.rb:88:in
call'
activesupport (4.2.2) lib/active_support/callbacks.rb:88:in _run_callbacks' activesupport (4.2.2) lib/active_support/callbacks.rb:776:in
_run_call_callbacks'
activesupport (4.2.2) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (4.2.2) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack (4.2.2) lib/action_dispatch/middleware/reloader.rb:73:in call' actionpack (4.2.2) lib/action_dispatch/middleware/remote_ip.rb:78:in
call'
rollbar (1.5.3) lib/rollbar/middleware/rails/rollbar.rb:24:in block in call' rollbar (1.5.3) lib/rollbar.rb:799:in
scoped'
rollbar (1.5.3) lib/rollbar/middleware/rails/rollbar.rb:22:in call' better_errors (2.1.1) lib/better_errors/middleware.rb:84:in
protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in better_errors_call' better_errors (2.1.1) lib/better_errors/middleware.rb:57:in
call'
actionpack (4.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in call' rollbar (1.5.3) lib/rollbar/middleware/rails/show_exceptions.rb:22:in
call_with_rollbar'
actionpack (4.2.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in call' railties (4.2.2) lib/rails/rack/logger.rb:38:in
call_app'
railties (4.2.2) lib/rails/rack/logger.rb:22:in call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:in
call_with_quiet_assets'
request_store (1.1.0) lib/request_store/middleware.rb:8:in call' actionpack (4.2.2) lib/action_dispatch/middleware/request_id.rb:21:in
call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in call' rack (1.6.4) lib/rack/runtime.rb:18:in
call'
activesupport (4.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call' rack (1.6.4) lib/rack/lock.rb:17:in
call'
actionpack (4.2.2) lib/action_dispatch/middleware/static.rb:113:in call' rack (1.6.4) lib/rack/sendfile.rb:113:in
call'
railties (4.2.2) lib/rails/engine.rb:518:in call' railties (4.2.2) lib/rails/application.rb:164:in
call'
rack (1.6.4) lib/rack/content_length.rb:15:in call' thin (1.6.3) lib/thin/connection.rb:86:in
block in pre_process'
thin (1.6.3) lib/thin/connection.rb:84:in catch' thin (1.6.3) lib/thin/connection.rb:84:in
pre_process'
thin (1.6.3) lib/thin/connection.rb:53:in process' thin (1.6.3) lib/thin/connection.rb:39:in
receive_data'
eventmachine (1.0.7) lib/eventmachine.rb:187:in run_machine' eventmachine (1.0.7) lib/eventmachine.rb:187:in
run'
thin (1.6.3) lib/thin/backends/base.rb:73:in start' thin (1.6.3) lib/thin/server.rb:162:in
start'
rack (1.6.4) lib/rack/handler/thin.rb:19:in run' rack (1.6.4) lib/rack/server.rb:286:in
start'
railties (4.2.2) lib/rails/commands/server.rb:80:in start' railties (4.2.2) lib/rails/commands/commands_tasks.rb:80:in
block in server'
railties (4.2.2) lib/rails/commands/commands_tasks.rb:75:in tap' railties (4.2.2) lib/rails/commands/commands_tasks.rb:75:in
server'
railties (4.2.2) lib/rails/commands/commands_tasks.rb:39:in run_command!' railties (4.2.2) lib/rails/commands.rb:17:in
<top (required)>'
bin/rails:8:in require' bin/rails:8:in
16:18:56 web.1 |
@alesthome please try master branch
@flyerhzm thanks for the quick response. Yeah, now it works (from master). The only other thing that changed is that now it doesn't work to pass a method for the available_users_names like it used to:
config.available_users_names = { :user => :switch_identifier }
User.rb
def switch_identifier
"#{role} | #{email} (id: #{id})"
end
thanks again!
@alesthome it's also fixed in version 1.0.1