On Thu, 15 May 2014 09:09:24 +0200 Sergio Cambra <[email protected]> wrote:
> AS uses rails to generate query, do you know how to generate a right query in > rails? Could > you post some examples of issue and fix in rails? Sorry, as I'm rather newbie in Rails. But I'l try to do what I can. Here is the issue, caused by the following line in my code: https://github.com/korobkov/fremantle/blob/master/app/models/fremantle/person.rb#L51 has_many :resources, -> { uniq }, :dependent => :restrict_with_error, :inverse_of => :people, :through => :person_resources When I explicitly unscope the order (Rails 4.1.x required), all is OK: has_many :resources, -> { unscope(:order).uniq }, :dependent => :restrict_with_error, :inverse_of => :people, :through => :person_resources Started GET "/fremantle/people/1/resources?association=resources&parent_scaffold=fremantle%2Fpeople" for 127.0.0.1 at 2014-05-15 18:04:01 +0400 Processing by Fremantle::ResourcesController#index as HTML Parameters: {"association"=>"resources", "parent_scaffold"=>"fremantle/people", "person_id"=>"1"} Fremantle::Person Load (0.8ms) SELECT "fremantle_people".* FROM "fremantle_people" WHERE "fremantle_people"."id" = $1 LIMIT 1 [["id", 1]] (1.0ms) SELECT DISTINCT COUNT(DISTINCT "fremantle_resources"."id") FROM "fremantle_resources" INNER JOIN "fremantle_person_resources" ON "fremantle_resources"."id" = "fremantle_person_resources"."resource_id" WHERE "fremantle_person_resources"."person_id" = $1 [["person_id", 1]] Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_header.html.erb (3.8ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_column_headings.html.erb (8.6ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_messages.html.erb (0.2ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_messages.html.erb (7.0ms) Fremantle::Resource Load (1.3ms) SELECT DISTINCT "fremantle_resources".* FROM "fremantle_resources" INNER JOIN "fremantle_person_resources" ON "fremantle_resources"."id" = "fremantle_person_resources"."resource_id" WHERE "fremantle_person_resources"."person_id" = $1 ORDER BY "fremantle_resources"."permalink" DESC LIMIT 15 OFFSET 0 [["person_id", 1]] Fremantle::ResourceType Load (0.6ms) SELECT "fremantle_resource_types".* FROM "fremantle_resource_types" WHERE "fremantle_resource_types"."id" IN (1) Fremantle::Attachment Load (0.7ms) SELECT "fremantle_attachments".* FROM "fremantle_attachments" WHERE "fremantle_attachments"."attachable_type" = 'Fremantle::Resource' AND "fremantle_attachments"."attachable_id" IN (1) Fremantle::SubdivisionResource Load (0.6ms) SELECT "fremantle_subdivision_resources".* FROM "fremantle_subdivision_resources" WHERE "fremantle_subdivision_resources"."resource_id" IN (1) Fremantle::Subdivision Load (0.6ms) SELECT "fremantle_subdivisions".* FROM "fremantle_subdivisions" WHERE "fremantle_subdivisions"."id" IN (1) Fremantle::Faculty Load (0.7ms) SELECT "fremantle_faculties".* FROM "fremantle_faculties" WHERE "fremantle_faculties"."id" = $1 LIMIT 1 [["id", 1]] Fremantle::Organization Load (0.6ms) SELECT "fremantle_organizations".* FROM "fremantle_organizations" WHERE "fremantle_organizations"."id" = $1 LIMIT 1 [["id", 1]] Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_record.html.erb (21.8ms) PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ...ntle_person_resources"."person_id" = $1 ORDER BY "fremantle... ^ : SELECT AVG("fremantle_resources"."people_count") AS avg_id FROM "fremantle_resources" WHERE "fremantle_resources"."id" IN (SELECT DISTINCT "fremantle_resources"."id" FROM "fremantle_resources" INNER JOIN "fremantle_person_resources" ON "fremantle_resources"."id" = "fremantle_person_resources"."resource_id" WHERE "fremantle_person_resources"."person_id" = $1 ORDER BY "fremantle_resources"."permalink" DESC) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_calculations.html.erb (4.8ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list.html.erb (77.8ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_with_header.html.erb (92.7ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/list.html.erb within layouts/fremantle/application (98.0ms) Completed 500 Internal Server Error in 124ms ActionView::Template::Error (PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ...ntle_person_resources"."person_id" = $1 ORDER BY "fremantle... ^ : SELECT AVG("fremantle_resources"."people_count") AS avg_id FROM "fremantle_resources" WHERE "fremantle_resources"."id" IN (SELECT DISTINCT "fremantle_resources"."id" FROM "fremantle_resources" INNER JOIN "fremantle_person_resources" ON "fremantle_resources"."id" = "fremantle_person_resources"."resource_id" WHERE "fremantle_person_resources"."person_id" = $1 ORDER BY "fremantle_resources"."permalink" DESC)): 3: <tr id="<%= active_scaffold_calculations_id %>" class="active-scaffold-calculations"> 4: <% columns.each do |column| -%> 5: <% if column.calculation? %> 6: <td id="<%= active_scaffold_calculations_id(:column => column) %>"><%= render_column_calculation(column) %></td> 7: <% else %> 8: <td> </td> 9: <% end -%> activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:862:in `prepare' activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:862:in `prepare_statement' activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:819:in `exec_cache' activerecord (4.1.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:138: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' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/helpers/view_helpers.rb:522:in `column_calculation' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/helpers/view_helpers.rb:529:in `render_column_calculation' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_calculations.html.erb:6:in `block in __home_korobkov__bundler_ruby_______bundler_gems_active_scaffold_e__db___f_b__app_views_active_scaffold_overrides__list_calculations_html_erb__3189263983793933790_70269308323200' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_calculations.html.erb:4:in `each' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_calculations.html.erb:4:in `__home_korobkov__bundler_ruby_______bundler_gems_active_scaffold_e__db___f_b__app_views_active_scaffold_overrides__list_calculations_html_erb__3189263983793933790_70269308323200' 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' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/extensions/action_view_rendering.rb:122:in `render_with_active_scaffold' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list.html.erb:33:in `__home_korobkov__bundler_ruby_______bundler_gems_active_scaffold_e__db___f_b__app_views_active_scaffold_overrides__list_html_erb___3598791423979284029_70269302431900' 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' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/extensions/action_view_rendering.rb:122:in `render_with_active_scaffold' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/_list_with_header.html.erb:34:in `__home_korobkov__bundler_ruby_______bundler_gems_active_scaffold_e__db___f_b__app_views_active_scaffold_overrides__list_with_header_html_erb__3145879113374306757_70269301839140' 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' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/extensions/action_view_rendering.rb:122:in `render_with_active_scaffold' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/app/views/active_scaffold_overrides/list.html.erb:1:in `__home_korobkov__bundler_ruby_______bundler_gems_active_scaffold_e__db___f_b__app_views_active_scaffold_overrides_list_html_erb___612589027890828005_70269301600660' 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' /usr/lib/ruby/2.1.0/benchmark.rb:294: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' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/extensions/action_controller_rendering.rb:14:in `render_with_active_scaffold' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/actions/list.rb:37:in `list_respond_to_html' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/actions/core.rb:250:in `block (3 levels) in respond_to_action' actionpack (4.1.1) lib/action_controller/metal/mime_responds.rb:258:in `call' actionpack (4.1.1) lib/action_controller/metal/mime_responds.rb:258:in `respond_to' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/actions/core.rb:246:in `respond_to_action' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/actions/list.rb:30:in `list' /home/korobkov/.bundler/ruby/2.1.0/bundler/gems/active_scaffold-e39db127f8b0/lib/active_scaffold/actions/list.rb:12:in `index' actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:4: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:113:in `call' activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting' activesupport (4.1.1) lib/active_support/callbacks.rb:149: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:149: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:149: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:149: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:149: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 `call' 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 `call' 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 `call' activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting' activesupport (4.1.1) lib/active_support/callbacks.rb:149: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:149: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:149: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:149: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:149: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:229:in `call' activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `block in halting' activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `call' activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `block in halting' activesupport (4.1.1) lib/active_support/callbacks.rb:149: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:215:in `call' activesupport (4.1.1) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional' activesupport (4.1.1) lib/active_support/callbacks.rb:215:in `call' activesupport (4.1.1) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional' activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `call' 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 `call' 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 `call' 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 `call' 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 `call' 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 `call' 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 `call' 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 `each' 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' railties (4.1.1) lib/rails/engine.rb:514:in `call' railties (4.1.1) lib/rails/railtie.rb:194:in `public_send' railties (4.1.1) lib/rails/railtie.rb:194:in `method_missing' 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 `each' 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: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' activerecord (4.1.1) lib/active_record/migration.rb:380: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' 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' 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' actionpack (4.1.1) lib/action_dispatch/middleware/static.rb:64:in `call' rack (1.5.2) lib/rack/sendfile.rb:112: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' puma (2.8.2) lib/puma/server.rb:490:in `handle_request' puma (2.8.2) lib/puma/server.rb:361:in `process_client' puma (2.8.2) lib/puma/server.rb:254:in `block in run' puma (2.8.2) lib/puma/thread_pool.rb:92:in `call' puma (2.8.2) lib/puma/thread_pool.rb:92:in `block in spawn_thread' Rendered /home/korobkov/.bundler/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.4ms) Rendered /home/korobkov/.bundler/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (14.0ms) One part of problem here seems for me to be in the fact, that calculation queries include ORDER clause (whether it's actually needed for them?) I guess, just removing ordering could solve the issue. But on the other side, I could imagine the situation, when default scope could potentially contain LIMIT clause, in which case ORDER clause will be essential… So, the "magic" would be either auto-adding to SELECT clause *all* columns from *all* ORDER clauses from *all* associations in the chain, which is near impossible!, or just automatically unscoping the ORDER clause from all unique associations for PostgreSQL adapter, which also could be "too much magic that we want"… Well, seems that this requires manual solution either way… (/me went to unscope all my uniq associations…) -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails Gem" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/activescaffold. For more options, visit https://groups.google.com/d/optout.
