I'm new to Rails. Today I've started to have issues related to Nokogiri and Digest MD5. When I ran rails s for the app I contribute to, it started to complain, first about Nokogiri not being installed and then about Digest md5.
discourse git:(after-hook-event) ✗ bundle install
/Users/jlijo/.rvm/rubies/ruby-2.4.0-turbo/lib/ruby/2.4.0/digest.rb:16:in `const_missing': library not found for class Digest::MD5 -- digest/md5 (LoadError)
I've fixed the issue with Nokogiri doing a xcode-select --install . The console also stopped to complain about digest md5 but still the app won't work (even tho, rails server starts), it raises an error:
Digest::MD5.hexdigest(`convert --version` << `convert -list font`)
undefined method `<<' for nil:NilClass
This is rather desperating, I've spent the whole afternoon trying to solve this issue. I don't know the root of it. I've reinstalled Ruby 2.4.0 again. I've ran gem install bundler, and bundle install.
LOGS:
D, [2017-08-18T19:28:22.945251 #64797] DEBUG -- : ThemeField Load (1.3ms) SELECT "theme_fields".* FROM "theme_fields" JOIN (
SELECT 2 AS theme_id, 0 AS sort_column
) as X ON X.theme_id = theme_fields.theme_id WHERE "theme_fields"."target_id" IN (1, 0) AND "theme_fields"."name" = 'header' ORDER BY sort_column, target_id [["name", "header"]]
bin/rails: No such file or directory - convert
bin/rails: No such file or directory - convert
I, [2017-08-18T19:28:22.973323 #64797] INFO -- : Rendered common/_discourse_javascript.html.erb (22.8ms)
I, [2017-08-18T19:28:22.975885 #64797] INFO -- : Completed 500 Internal Server Error in 683ms (ActiveRecord: 98.6ms)
F, [2017-08-18T19:28:22.994012 #64797] FATAL -- :
NoMethodError - undefined method `<<' for nil:NilClass:
lib/letter_avatar.rb:103:in `image_magick_version'
lib/letter_avatar.rb:26:in `version'
app/views/common/_discourse_javascript.html.erb:44:in `_app_views_common__discourse_javascript_html_erb___995238869359027967_70217684279780'
actionview (4.2.9) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.9) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.9) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.9) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.10.5) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
actionview (4.2.9) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.9) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.9) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.9) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.9) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.9) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.9) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.9) lib/action_view/renderer/renderer.rb:51:in `render_partial'
actionview (4.2.9) lib/action_view/renderer/renderer.rb:25:in `render'
actionview (4.2.9) lib/action_view/helpers/rendering_helper.rb:32:in `render'
app/views/layouts/application.html.erb:121:in `_app_views_layouts_application_html_erb___469980189180314768_70217688394860'
actionview (4.2.9) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.9) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.9) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.9) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.10.5) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
actionview (4.2.9) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
actionview (4.2.9) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (4.2.9) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (4.2.9) lib/action_view/renderer/renderer.rb:46:in `render_template'
actionview (4.2.9) lib/action_view/renderer/renderer.rb:27:in `render'
actionview (4.2.9) lib/action_view/rendering.rb:100:in `_render_template'
actionpack (4.2.9) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.2.9) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (4.2.9) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.2.9) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.9) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.9) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.9) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.9) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/jlijo/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
activesupport (4.2.9) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.9) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.9) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (4.2.9) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.9) lib/action_controller/metal/instrumentation.rb:43:in `render'
lib/topic_list_responder.rb:15:in `block (2 levels) in respond_with_list'
actionpack (4.2.9) lib/action_controller/metal/mime_responds.rb:217:in `respond_to'
lib/topic_list_responder.rb:11:in `respond_with_list'
app/controllers/list_controller.rb:91:in `block (2 levels) in <class:ListController>'
actionpack (4.2.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.9) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.9) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.9) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.9) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.9) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.9) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.9) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.9) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.9) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.9) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.9) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.9) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.9) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.9) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.9) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.9) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.9) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.9) lib/action_view/rendering.rb:30:in `process'
rack-mini-profiler (0.10.5) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
actionpack (4.2.9) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.9) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.9) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.9) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.9) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.9) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.9) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.9) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.9) lib/action_dispatch/routing/route_set.rb:817:in `call'
rack-protection (1.5.3) lib/rack/protection/frame_options.rb:31:in `call'
omniauth (1.6.1) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/builder.rb:63:in `call'
rack (1.6.8) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.8) lib/rack/head.rb:13:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.8) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.8) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.9) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.9) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.9) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.9) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.9) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/remote_ip.rb:78: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.9) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
logster (1.2.7) lib/logster/middleware/reporter.rb:31:in `call'
railties (4.2.9) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.9) lib/rails/rack/logger.rb:22:in `call'
config/initializers/100-quiet_logger.rb:17:in `call_with_quiet_assets'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.8) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.8) lib/rack/runtime.rb:18:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/static.rb:120:in `call'
actionpack (4.2.9) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.8) lib/rack/sendfile.rb:113:in `call'
lib/middleware/missing_avatars.rb:21:in `call'
lib/middleware/turbo_dev.rb:34:in `call'
rack-mini-profiler (0.10.5) lib/mini_profiler/profiler.rb:282:in `call'
message_bus (2.0.5) lib/message_bus/rack/middleware.rb:63:in `call'
railties (4.2.9) lib/rails/engine.rb:518:in `call'
railties (4.2.9) lib/rails/application.rb:165:in `call'
railties (4.2.9) lib/rails/railtie.rb:194:in `method_missing'
rack (1.6.8) lib/rack/urlmap.rb:66:in `block in call'
rack (1.6.8) lib/rack/urlmap.rb:50:in `call'
rack (1.6.8) lib/rack/content_length.rb:15:in `call'
puma (3.9.1) lib/puma/configuration.rb:224:in `call'
puma (3.9.1) lib/puma/server.rb:602:in `handle_request'
puma (3.9.1) lib/puma/server.rb:435:in `process_client'
puma (3.9.1) lib/puma/server.rb:299:in `block in run'
puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
D, [2017-08-18T19:28:23.107322 #64797] DEBUG -- :
D, [2017-08-18T19:28:23.107454 #64797] DEBUG -- :
I, [2017-08-18T19:28:23.107604 #64797] INFO -- : Started POST "/__better_errors/5a9496d634c72ab8/variables" for ::1 at 2017-08-18 19:28:23 +0200
bin/rails: No such file or directory - convert
bin/rails: No such file or directory - convert
bin/rails: No such file or directory - convert
bin/rails: No such file or directory - convert
bin/rails: No such file or directory - convert
bin/rails: No such file or directory - convert
You might not have ImageMagick installed, which is where the convert command comes from. That will error out and leave you with nil.
Related
I try to add a "show" Interface for payments on Active Admin, so I added this code to my file "app/admin/payments.rb" :
ActiveAdmin.register Payment do
actions :index, :show
index do
column "Actions" do |payment|
links = []
links << link_to("View", admin_payment_path(payment))
links.join(" <br><br> ").html_safe
end
end
show do
attributes_table do
row :id
row :remote_id
row :credit_card_id
row :State
row :Refund_id
row :Created_at
row :updated_at
row :amount
row :currency
row :subscription_id
end
active_admin_comments
end
end
And I call this show action like that :
link_to("View", admin_payment_path(payment))
I have the following error thaht I can not understand :
ActionView::Template::Error (wrong number of arguments (1 for 0)):
1: insert_tag renderer_for(:show)
activerecord (4.0.3) lib/active_record/attribute_methods/read.rb:58:in `__temp__d6564786f646'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/view_helpers/display_helper.rb:30:in `display_name_method_for'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/view_helpers/display_helper.rb:18:in `display_name'
arbre (1.0.1) lib/arbre/element.rb:175:in `method_missing'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/show.rb:36:in `default_title'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/show.rb:14:in `title'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/base.rb:25:in `block in build_active_admin_head'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/base.rb:24:in `build_active_admin_head'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/base.rb:9:in `build'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
/ruby/bundler/gems/active_admin-9ca081f47ab4/app/views/active_admin/resource/show.html.arb:1:in `block in __ruby_bundler_gems_active_admin__ca___f__ab__app_views_active_admin_resource_show_html_arb__2881818806947822812_77228080'
arbre (1.0.1) lib/arbre/context.rb:45:in `instance_eval'
arbre (1.0.1) lib/arbre/context.rb:45:in `initialize'
/ruby/bundler/gems/active_admin-9ca081f47ab4/app/views/active_admin/resource/show.html.arb:1:in `new'
/ruby/bundler/gems/active_admin-9ca081f47ab4/app/views/active_admin/resource/show.html.arb:1:in `__ruby_bundler_gems_active_admin__ca___f__ab__app_views_active_admin_resource_show_html_arb__2881818806947822812_77228080'
actionpack (4.0.3) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.3) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.3) lib/action_view/template.rb:141:in `render'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
actionpack (4.0.3) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.3) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.3) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.3) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.3) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.3) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.3) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.3) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.3) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
activesupport (4.0.3) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.3) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.0.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:233:in `default_render'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:161:in `to_html'
responders (1.0.0) lib/responders/flash_responder.rb:104:in `to_html'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:154:in `respond'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:147:in `call'
actionpack (4.0.3) lib/action_controller/metal/mime_responds.rb:330:in `respond_with'
inherited_resources (1.4.1) lib/inherited_resources/actions.rb:13:in `show'
actionpack (4.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.3) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.3) lib/active_support/callbacks.rb:463:in `_run__1186283259363649751__process_action__callbacks'
activesupport (4.0.3) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.3) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.3) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.3) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.3) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.3) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.3) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:680:in `call'
omniauth (1.4.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.4.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.4.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.4.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.4.2) lib/omniauth/builder.rb:63: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.5.5) lib/rack/etag.rb:23:in `call'
rack (1.5.5) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.5) lib/rack/head.rb:11:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.3) lib/active_record/query_cache.rb:36:in `call'
airbrake (9.0.2) lib/airbrake/rack/middleware.rb:33:in `call!'
airbrake (9.0.2) lib/airbrake/rack/middleware.rb:21:in `call'
activerecord (4.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.3) lib/active_support/callbacks.rb:373:in `_run__4337536015866295967__call__callbacks'
activesupport (4.0.3) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.5) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.5) lib/rack/lock.rb:17:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
rack-cors (0.4.1) lib/rack/cors.rb:81:in `call'
railties (4.0.3) lib/rails/engine.rb:511:in `call'
railties (4.0.3) lib/rails/application.rb:97:in `call'
rack (1.5.5) lib/rack/content_length.rb:14:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `catch'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.5.5) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.5) lib/rack/server.rb:264:in `start'
railties (4.0.3) lib/rails/commands/server.rb:84:in `start'
railties (4.0.3) lib/rails/commands.rb:76:in `block in <top (required)>'
railties (4.0.3) lib/rails/commands.rb:71:in `tap'
railties (4.0.3) lib/rails/commands.rb:71:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Rendered /ruby/gems/actionpack-4.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
Rendered /ruby/gems/actionpack-4.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms)
Rendered /ruby/gems/actionpack-4.0.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (10.3ms)
Thank you for your help, I am a beginner in Ruby On Rails and ActiveAdmin
It looks like the block opened by attributes_table do isn't closed, so I'd start by adding an end after the last row line and seeing if the error changes or disappears.
Also, for what it's worth, based on ActiveAdmin's API documentation, I don't think the line actions :index, :show is necessary -- it specifically says that "all CRUD actions are enabled by default", so there shouldn't be a need to explicitly define those actions. I might try taking it out and seeing what happens.
The exception indicates ActiveAdmin is not finding a default title for the page, so try:
show title: 'Payment' do
...
end
or define a display_name() method on the Payment model.
I am working with Ruby 2.3.3, Rails 5.1.5 and using the RubyMine (JetBrains) IDE and I am working the gon gem to send data to javascript. In my application.html.erb I am setting the <%= include_gon %> in the head (as specified by the gon documentation) and I am getting the illegal/malformed utf-8 exception. I ran this same code on C9 with Ruby 2.4.1 and Rails 5.1.4 with no error.
Here is the full stack trace:
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:36:in `to_json'
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:36:in `to_json'
activesupport (5.1.6) lib/active_support/json/encoding.rb:55:in `to_json'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/json/common.rb:224:in `generate'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/json/common.rb:224:in `generate'
activesupport (5.1.6) lib/active_support/json/encoding.rb:100:in `stringify'
activesupport (5.1.6) lib/active_support/json/encoding.rb:33:in `encode'
activesupport (5.1.6) lib/active_support/json/encoding.rb:20:in `encode'
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:39:in `to_json'
multi_json (1.13.1) lib/multi_json/adapters/json_common.rb:19:in `dump'
multi_json (1.13.1) lib/multi_json/adapter.rb:25:in `dump'
multi_json (1.13.1) lib/multi_json.rb:139:in `dump'
gon (6.2.0) lib/gon/json_dumper.rb:4:in `dump'
gon (6.2.0) lib/gon/base.rb:93:in `to_json'
gon (6.2.0) lib/gon/base.rb:77:in `render_variable'
gon (6.2.0) lib/gon/base.rb:51:in `block in formatted_data'
gon (6.2.0) lib/gon/base.rb:51:in `each'
gon (6.2.0) lib/gon/base.rb:51:in `map'
gon (6.2.0) lib/gon/base.rb:51:in `formatted_data'
gon (6.2.0) lib/gon/base.rb:24:in `render_data'
gon (6.2.0) lib/gon/helpers.rb:5:in `include_gon'
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__726524811_120260856'
actionview (5.1.6) lib/action_view/template.rb:157:in `block in render'
activesupport (5.1.6) lib/active_support/notifications.rb:168:in `instrument'
actionview (5.1.6) lib/action_view/template.rb:352:in `instrument_render_template'
actionview (5.1.6) lib/action_view/template.rb:155:in `render'
actionview (5.1.6) lib/action_view/renderer/template_renderer.rb:64:in `render_with_layout'
actionview (5.1.6) lib/action_view/renderer/template_renderer.rb:50:in `render_template'
actionview (5.1.6) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.1.6) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.1.6) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.1.6) lib/action_view/rendering.rb:103:in `_render_template'
actionpack (5.1.6) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.1.6) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.1.6) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.1.6) lib/action_controller/metal/renderers.rb:141:in `render_to_body'
actionpack (5.1.6) lib/abstract_controller/rendering.rb:24:in `render'
actionpack (5.1.6) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.1.6) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.1.6) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
activesupport (5.1.6) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.1.6) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.1.6) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (5.1.6) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
actionpack (5.1.6) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (5.1.6) lib/action_controller/metal/implicit_render.rb:33:in `default_render'
actionpack (5.1.6) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
actionpack (5.1.6) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
actionpack (5.1.6) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.6) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.6) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.6) lib/active_support/callbacks.rb:131:in `run_callbacks'
actionpack (5.1.6) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.6) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.6) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.6) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.6) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.6) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.6) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
activerecord (5.1.6) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.6) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.6) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.6) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.6) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:844:in `call'
rack (2.0.4) lib/rack/etag.rb:25:in `call'
rack (2.0.4) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.4) lib/rack/head.rb:12:in `call'
rack (2.0.4) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.4) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.6) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.6) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.6) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
request_store (1.4.1) lib/request_store/middleware.rb:19:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.4) lib/rack/method_override.rb:22:in `call'
rack (2.0.4) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.4) lib/rack/sendfile.rb:111:in `call'
railties (5.1.6) lib/rails/engine.rb:522:in `call'
puma (3.11.3) lib/puma/configuration.rb:225:in `call'
puma (3.11.3) lib/puma/server.rb:624:in `handle_request'
puma (3.11.3) lib/puma/server.rb:438:in `process_client'
puma (3.11.3) lib/puma/server.rb:302:in `block in run'
puma (3.11.3) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
I have been searching all over the internet for a solution but this dilemma seems to be localized to me. Also, the GemFile does have the gem 'gon' line and I performed a bundle install and update. I have also tried to run this locally on Ruby 2.4.3 and the same error persists. Please help.
lets say i have a model with enum like this :
class Apt < ActiveRecord::Base
enum apt_status: [ :draft, :publish, :unpublish, :waiting ]
end
and in my controller i load my enum like this :
#apt_statuses = Apt.apt_statuses
it's working fine, but what if i want to load my enum values based on user role?
so lets say if i am an admin i want to load all my enum values, and if i am not an admin, i only display 3 enum values
":draft, :unpublish, :waiting"
is it possible? please suggest. many thanks.
btw here is my controller, i really have no idea how to fill my
#apt_statuses
in else condition
ishaveprivilage = Usermaster.joins(:rolemasters, :rolemasters).where(id: #current_user.id, rolemasters: {name: "Super Admin"})
if ishaveprivilage
#apt_statuses = Apt.apt_statuses
else
end
i use my enum in view like this :
<%= f.select :apt_status, options_for_select(#apt_statuses.collect { |s| [s[0].humanize, s[0]] }, selected: #apt.apt_status), {} , class: "form-control" %>
error trace :
NoMethodError in Admin::Apts#new
Showing C:/Users/lenovo/Documents/urbanace/urbanacecode/app/views/admin/apts/_form.html.erb where line #134 raised:
undefined method `humanize' for :draft:Symbol
Trace of template inclusion: app/views/admin/apts/new.html.erb
Rails.root: C:/Users/lenovo/Documents/urbanace/urbanacecode
Application Trace | Framework Trace | Full Trace
app/views/admin/apts/_form.html.erb:134:in `block (2 levels) in _app_views_admin_apts__form_html_erb___8345113_90629556'
app/views/admin/apts/_form.html.erb:134:in `each'
app/views/admin/apts/_form.html.erb:134:in `collect'
app/views/admin/apts/_form.html.erb:134:in `block in _app_views_admin_apts__form_html_erb___8345113_90629556'
actionview (4.2.7) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionview (4.2.7) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer'
actionview (4.2.7) lib/action_view/helpers/capture_helper.rb:38:in `capture'
actionview (4.2.7) lib/action_view/helpers/form_helper.rb:444:in `form_for'
app/views/admin/apts/_form.html.erb:57:in `_app_views_admin_apts__form_html_erb___8345113_90629556'
actionview (4.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:143:in `render'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:51:in `render_partial'
actionview (4.2.7) lib/action_view/helpers/rendering_helper.rb:35:in `render'
app/views/admin/apts/new.html.erb:2:in `_app_views_admin_apts_new_html_erb__809278863_96977256'
actionview (4.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:143:in `render'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:46:in `render_template'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:27:in `render'
actionview (4.2.7) lib/action_view/rendering.rb:100:in `_render_template'
actionpack (4.2.7) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.2.7) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (4.2.7) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.2.7) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.7) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.7) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.7) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
activesupport (4.2.7) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (4.2.7) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:43:in `render'
remotipart (1.2.1) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
actionpack (4.2.7) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.2.7) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.2.7) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.7) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.7) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.7) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.7) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.7) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.7) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.7) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.7) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.7) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.7) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.7) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:817: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'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.7) 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.7) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.7) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.7) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.7) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.7) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.7) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.7) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.7) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.7) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.7) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.7) 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.7) 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.7) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.7) lib/rails/engine.rb:518:in `call'
railties (4.2.7) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Request
Parameters:
None
Toggle session dump
_csrf_token: "DK6t1OuVBdMWZLihVgktZFIQSo7gX3qt5Iq5ZHyA7lM="
session_id: "2391dc6faaafcd52ee1815ccbe115daf"
user_id: 7
Toggle env dump
GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
HTTP_ACCEPT_ENCODING: "gzip, deflate, sdch"
HTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.8"
HTTP_CACHE_CONTROL: "max-age=0"
REMOTE_ADDR: "127.0.0.1"
REMOTE_HOST: "127.0.0.1"
SERVER_NAME: "localhost"
SERVER_PROTOCOL: "HTTP/1.1"
Response
Headers:
None
x
>>
I think I would solve this like so:
class Apt < ActiveRecord::Base
enum status: [:draft, :publish, :unpublish, :waiting]
def self.user_specific_statuses(user)
if user.admin? # define a method in your user model which defines this.
Apt.statuses
else
Apt.statuses.reject { |k, v| k == "publish" } # => all except publish
end
end
end
And then you could call it like this:
Apt.user_specific_statuses(admin_user) # => all statuses
Apt.user_specific_statuses(normal_user) # => only draft, unpublish, waiting
i don't know is this an ideal way to do this or not but i solved it with this approach :
i changed my model enum definition to this :
model : enum apt_status: { draft:0, publish:1, unpublish:2, waiting:3 }
and in my controller i did this :
ishaveprivilage = Usermaster.joins(:rolemasters, :rolemasters).where(id: #current_user.id, rolemasters: {name: "Super Admin"})
if !ishaveprivilage.blank?
#apt_statuses = Apt.apt_statuses
else
temp = Apt.apt_statuses.reject { |k,v| v == 1 } #remove Publish option for non super admin
#apt_statuses = temp
end
if you guys have a better approach, please advise.
I am using paperclip to store images. After updating to 5.1.0 (released tonight) I get the following error:
undefined method `[]' for nil:NilClass
My code in the view is this:
<%= #company.pic1.url(:large)%>
A change in 5.1.0 is the switch to leave s3_protocol as an empty string, if not set in the app: Is it possible to configure Paperclip to produce HTTPS urls?
Following the advice there, I tried setting that string in the model to "http", "https" and :https, but didnt solve the problem.
What could be wrong? This is my model:
has_attached_file :pic1, :styles => { :large => "1000x600", :mid => "400x160", :thumb => "120x80>" }, :default_url => "https://s3.eu-central-1.amazonaws.com/server.assets/images/missing/image_missing_:style.png", :storage => :s3, :s3_credentials => APP_CONFIG["s3"], :path => ":class/:attachment/:style/:id.:extension", :s3_region => "eu-central-1", :s3_protocol => "http"
Thank you for any ideas how to solve this.
Full stacktrace here:
NoMethodError - undefined method `[]' for nil:NilClass:
delayed_paperclip (3.0.0) lib/delayed_paperclip/url_generator.rb:11:in `for' paperclip (5.1.0) lib/paperclip/attachment.rb:146:in `url'
app/views/public/_single_company_slide.html.erb:47:in `_app_views_public__single_company_slide_html_erb__1195386595_87856600'
actionview (4.2.5) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.5) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.5) lib/action_view/template.rb:143:in `render'
actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.5) lib/action_view/renderer/renderer.rb:47:in `render_partial'
actionview (4.2.5) lib/action_view/renderer/renderer.rb:21:in `render'
actionview (4.2.5) lib/action_view/helpers/rendering_helper.rb:32:in `render'
app/views/public/_landing_slider.html.erb:18:in `block in _app_views_public__landing_slider_html_erb___1162164959_87953600'
activerecord (4.2.5) lib/active_record/relation/delegation.rb:132:in `method_missing'
activerecord (4.2.5) lib/active_record/relation/delegation.rb:99:in `method_missing'
app/views/public/_landing_slider.html.erb:17:in `_app_views_public__landing_slider_html_erb___1162164959_87953600'
actionview (4.2.5) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.5) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.5) lib/action_view/template.rb:143:in `render'
actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.5) lib/action_view/renderer/renderer.rb:47:in `render_partial'
actionview (4.2.5) lib/action_view/renderer/renderer.rb:21:in `render'
actionview (4.2.5) lib/action_view/helpers/rendering_helper.rb:32:in `render'
app/views/public/home.html.erb:38:in `block in _app_views_public_home_html_erb___728996521_86764780'
actionview (4.2.5) lib/action_view/helpers/cache_helper.rb:190:in `write_fragment_for'
actionview (4.2.5) lib/action_view/helpers/cache_helper.rb:179:in `fragment_for'
actionview (4.2.5) lib/action_view/helpers/cache_helper.rb:115:in `cache'
app/views/public/home.html.erb:1:in `_app_views_public_home_html_erb___728996521_86764780'
actionview (4.2.5) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.5) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.5) lib/action_view/template.rb:143:in `render'
actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (4.2.5) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (4.2.5) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (4.2.5) lib/action_view/rendering.rb:100:in `_render_template'
actionpack (4.2.5) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.2.5) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (4.2.5) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.2.5) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.5) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.5) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
C:/Ruby22-x64/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:43:in `render'
remotipart (1.2.1) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.2.5) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.5) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.5) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.5) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.5) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.5) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.5) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.5) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.5) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.5) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.5) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call'
meta_request (0.4.0) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
meta_request (0.4.0) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
rack-attack (5.0.1) lib/rack/attack.rb:147:in `call'
rack (1.6.4) lib/rack/deflater.rb:35:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) 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'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.5) 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.5) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.5) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.5) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78: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.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
rack-contrib (1.4.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.4.0) lib/meta_request/middlewares/headers.rb:16:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
actionpack (4.2.5) 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.5) 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.5) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.5) lib/rails/engine.rb:518:in `call'
railties (4.2.5) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
thin (1.7.0) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.7.0) lib/thin/connection.rb:84:in `pre_process'
thin (1.7.0) lib/thin/connection.rb:53:in `process'
thin (1.7.0) lib/thin/connection.rb:39:in `receive_data'
eventmachine-1.2.0.1-x64 (mingw32) lib/eventmachine.rb:194:in `run'
thin (1.7.0) lib/thin/backends/base.rb:73:in `start'
thin (1.7.0) 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.5) lib/rails/commands/server.rb:80:in `start'
railties (4.2.5) lib/rails/commands/commands_tasks.rb:80:in `block in server'
railties (4.2.5) lib/rails/commands/commands_tasks.rb:75:in `server'
railties (4.2.5) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
railties (4.2.5) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `<main>'
This is an old question and I'm posting here just in case anyone is maintaining a legacy project (and not switching to ActiveStorage). xfactorial solution did the trick for me. bundle update delayed_paperclip bumped the version up to 3.0.1.
My tests are passing now and the app is running ok.
Try updating your delayed_paperclip gem to 3.0.1
I updated from RoR 4.0.4 to 4.1.1 to apply the latest security patch and it appears pg_search broke.
Here's a error:
PG::SyntaxError: ERROR: syntax error at or near "AS"
LINE 1: ...sh', ''' ' || unaccent('banner') || ' ''')), 0))) AS pg_sear...
I'm searching via ajax but i don't think that is the issue based on the output above. I'm also using will_paginate but the branch I'm using is supposed to fix previous issues with rails 4.1.x and pg_search.
gem 'will_paginate', :git => 'https://github.com/nazgum/will_paginate.git' #until rails 4.1 will_paginate fixed
This is the code model where i'm executing the search:
include PgSearch
pg_search_scope :search, against: [:title, :body],
using: {tsearch: {dictionary: "english"}},
ignoring: :accents
def self.text_search(query)
if query.present?
search(query)
else
scoped
end
end
Everything was working prior to the RoR version bump - hoping someone might have some advice.
Here's the full stacktrace:
: SELECT COUNT("photos".*, ((ts_rank((to_tsvector('english', unaccent(coalesce("photos"."description"::text, ''))) || to_tsvector('english', unaccent(coalesce(pg_search_3b58f11462e6f0086ceffb.pg_search_dc60169d7766a303bd09de::text, '')))), (to_tsquery('english', ''' ' || unaccent('"banner"') || ' ''')), 0))) AS pg_search_rank) FROM "photos" LEFT OUTER JOIN (SELECT "photos"."id" AS id, string_agg("products"."name"::text, ' ') AS pg_search_dc60169d7766a303bd09de FROM "photos" INNER JOIN "products" ON "products"."id" = "photos"."product_id" GROUP BY "photos"."id") pg_search_3b58f11462e6f0086ceffb ON pg_search_3b58f11462e6f0086ceffb.id = "photos"."id" WHERE "photos"."placement" = 'showcase' AND (((to_tsvector('english', unaccent(coalesce("photos"."description"::text, ''))) || to_tsvector('english', unaccent(coalesce(pg_search_3b58f11462e6f0086ceffb.pg_search_dc60169d7766a303bd09de::text, '')))) ## (to_tsquery('english', ''' ' || unaccent('"banner"') || ' ''')))) AND "photos"."is_active" = 't':
activerecord (4.1.1) lib/active_record/connection_adapters/abstract_adapter.rb:362:in `translate_exception_class'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract_adapter.rb:375:in `rescue in log'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract_adapter.rb:373:in `log'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:947:in `select'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/database_statements.rb:31:in `select_all'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/query_cache.rb:67:in `block in select_all'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/query_cache.rb:82:in `cache_sql'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/query_cache.rb:67:in `select_all'
activerecord (4.1.1) lib/active_record/relation/calculations.rb:254:in `execute_simple_calculation'
activerecord (4.1.1) lib/active_record/relation/calculations.rb:216:in `perform_calculation'
activerecord (4.1.1) lib/active_record/relation/calculations.rb:111:in `calculate'
activerecord (4.1.1) lib/active_record/relation/calculations.rb:26:in `count'
app/views/showcases/_index.html.haml:1:in `_app_views_showcases__index_html_haml__780171647705973812_70320535206900'
actionview (4.1.1) lib/action_view/template.rb:145:in `block in render'
activesupport (4.1.1) lib/active_support/notifications.rb:161:in `instrument'
actionview (4.1.1) lib/action_view/template.rb:339:in `instrument'
actionview (4.1.1) lib/action_view/template.rb:143:in `render'
actionview (4.1.1) lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
actionview (4.1.1) lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
actionview (4.1.1) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.1.1) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.1) lib/active_support/notifications.rb:159:in `instrument'
actionview (4.1.1) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionview (4.1.1) lib/action_view/renderer/partial_renderer.rb:278:in `render'
actionview (4.1.1) lib/action_view/renderer/renderer.rb:47:in `render_partial'
actionview (4.1.1) lib/action_view/renderer/renderer.rb:21:in `render'
actionview (4.1.1) lib/action_view/helpers/rendering_helper.rb:32:in `render'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:12:in `render_with_haml'
app/views/showcases/index.js.erb:4:in `_app_views_showcases_index_js_erb__1635704546300671617_70320482208180'
actionview (4.1.1) lib/action_view/template.rb:145:in `block in render'
activesupport (4.1.1) lib/active_support/notifications.rb:161:in `instrument'
actionview (4.1.1) lib/action_view/template.rb:339:in `instrument'
actionview (4.1.1) lib/action_view/template.rb:143:in `render'
actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template'
actionview (4.1.1) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.1.1) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.1) lib/active_support/notifications.rb:159:in `instrument'
actionview (4.1.1) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template'
actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout'
actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:53:in `render_template'
actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionview (4.1.1) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (4.1.1) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (4.1.1) lib/action_view/rendering.rb:99:in `_render_template'
actionpack (4.1.1) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.1.1) lib/action_view/rendering.rb:82:in `render_to_body'
actionpack (4.1.1) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.1.1) lib/action_controller/metal/renderers.rb:32:in `render_to_body'
actionpack (4.1.1) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.1.1) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.1.1) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/bret/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (4.1.1) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.1.1) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.1.1) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.1) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.1) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.1) lib/active_support/callbacks.rb:86:in `run_callbacks'
actionpack (4.1.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.1.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.1.1) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.1) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.1.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.1.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.1.1) lib/abstract_controller/base.rb:136:in `process'
actionview (4.1.1) lib/action_view/rendering.rb:30:in `process'
actionpack (4.1.1) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.1.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.1.1) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.1.1) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.1.1) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:676:in `call'
omniauth (1.2.1) lib/omniauth/strategy.rb:404:in `call_app!'
omniauth-identity (1.1.1) lib/omniauth/strategies/identity.rb:43:in `other_phase'
omniauth (1.2.1) lib/omniauth/strategy.rb:185:in `call!'
omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.2.1) lib/omniauth/builder.rb:59:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.1.1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.1) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.1) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
sentry-raven (0.8.0) lib/raven/rack.rb:47:in `call'
railties (4.1.1) lib/rails/engine.rb:514:in `call'
railties (4.1.1) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
railties (4.1.1) lib/rails/rack/debugger.rb:20:in `call'
thin (1.6.2) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.6.2) lib/thin/connection.rb:84:in `pre_process'
thin (1.6.2) lib/thin/connection.rb:53:in `process'
thin (1.6.2) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.2) lib/thin/backends/base.rb:73:in `start'
thin (1.6.2) lib/thin/server.rb:162:in `start'
rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.2) lib/rack/server.rb:264:in `start'
railties (4.1.1) lib/rails/commands/server.rb:69:in `start'
railties (4.1.1) lib/rails/commands/commands_tasks.rb:81:in `block in server'
railties (4.1.1) lib/rails/commands/commands_tasks.rb:76:in `server'
railties (4.1.1) lib/rails/commands/commands_tasks.rb:40:in `run_command!'
railties (4.1.1) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `<main>'
#supports.count(:all) should work, the #supports.count syntax got deprecated in rails 4.1.1
There is a good conversation here to clarify the problem.
This is weird - when i call
=#supports.count
the error is generated but it is a valid object. It's a bit hacky but this is working for now:
=#supports.to_a.count