-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined method `users_user_id_eq' for Ransack::Search<class: Detail, base: Grouping <combinator: and>>:Ransack::Search #2565
Comments
Can you run this and report on the results? ActiveAdmin.application.namespaces[:admin].resources[:Detail].filters |
Sure you bet: => {:competitor_details=>{}, :competitors=>{}, :collections=>{}, :users=>{}, :authentications=>{}, :reports=>{}, :created_at=>{}, :updated_at=>{}, :params=>{}} |
Hmm... and I assume you don't have any custom filters set up, and a Detail |
The structure of that method ( |
I did at one point(In another admin .rb file) but took them out as I didn't need them any more. ActiveAdmin.register Detail do
menu :parent => "Models"
index do
column :id
column :type
column :created_at
column :params
actions
end
end
class Detail < ActiveRecord::Base
has_many :competitor_details, dependent: :destroy
has_many :competitors, through: :competitor_details
has_many :users, through: :competitors
# ...
end |
Ah, yeah we aren't correctly handling nested ActiveAdmin.register Detail do
remove_filter :users
end |
@shekibobo any idea on how to detect nested HMT associations? |
@daxter - Awesome. Thanks so much for the help; wasn't finding it from searching. That fixed the problem. |
Well, it hid the problem :V |
True.. :) Should I close or leave open for HMT? |
Yeah definitely leave this open. We'll get this fixed. |
Yeah this is gonna be a fun one. Might even get recursive. Rough brainstorm on this: reflection_chain = []
r = reflection
while r.through_reflection
reflection_chain << r.through_reflection.name
r = r.through_reflection
end
reflection_chain.reverse! << reflection.source_reflection.foreign_key
name = reflection_chain.join('_') Search appears to work on the command line. Running through |
@perkins2099 Can you set the filter to |
So, I've found a way to build this association chain, but I don't think Ransack supports nesting associations that deeply. I have an association chain like so: A has many B. C has many D. A has many E through C. This is probably a terrible way to use through associations, but even so, I want to filter A by E. For a single through association, we would use the search method named:
That is, the through association name, and the target association foreign key. So in the case of filtering A by E, we would presumably follow this pattern:
My first implementation would not support this, because the through associations don't exist between every association. We need to track the association chain all the way through. TIL def input_name
return method if seems_searchable?
# Deal with has_many :through relationships in filters
# If the relationship is a HMT, we set the search logic to be something
# like :#{through_association}_#{end_association_id}.
if through_association?
chain = reflection.chain.slice(1..-1).reverse.map(&:name) << reflection.foreign_key
name = chain.join('_')
else
name = method.to_s
name.concat '_id' if reflection
end
name.concat multiple? ? '_in' : '_eq'
end
reflection.chain #=> [:Es, :Ds, :Cs, :Bs]
# we need to get rid of :Es and replace it with :E_id, then reverse it and join by '_' The above code gives us the method chain I would think would work, but I still get an error message about the search method in my app. Wondering if we can get some input from the good people on the Ransack team? |
What's the error you get? If it's too complicated, maybe we should just prevent nested HMT associations from being added to the default list of filters. |
Might be the best bet. I get an error that the method I created, i.e. :bs_cs_ds_e_id_eq was not found. I believe it was a ransack error, but I'd have to double check, and I'm not at my computer right now. I did ping @radar on Twitter about the depth of association searches in Ransack, and am waiting to hear back from him. Might just be my assumption about how those search methods are formulated is wrong. |
|
@shekibobo - For the question regarding check boxes. I still get the error with those modifications |
@perkins2099 Could you try my branch and see if it fixes your issue?
|
It looks like my assumption of being able to just chain association names together was flat out wrong, but now it's clear to me why. They work on a single I'm good with switching back to the old concatenation method if you want. The chain method works nicely, but it might seem a bit too much like magic to someone down the road. |
Seems like you all got it figured out before I came here. Glad :) |
Yup. Thanks for checking it out, though! |
@shekibobo - This branch works for me(Removed the remove_filter bits)! Thanks for the diligence. |
@shekibobo - I tried your branch, still have a problem
seems to be caused by a has_many through: <has_one> |
@bughit Can you show me how the patient plan relationship is defined? |
b9ab250 is not working. class Patient < User
has_one :patient_plan, inverse_of: :patient, dependent: :destroy
has_many :patient_plan_goals, through: :patient_plan |
there's also another level of through nesting, |
I guess I hadn't considered a |
I'm seeing the same issue as @jufemaiz. I have a HMT relationship where the join table has no ID column. In my case, the model
|
I experimented a little this morning with the issue I'm seeing. I was expecting the offending line to be the has_many in the ActiveAdmin register class, but that's not the case - commenting it out did nothing. If I comment out the |
I am also seeing this issue still, and have had to invoke # app.rb
class App < ActiveRecord::Base
has_and_belongs_to_many :users
belongs_to :account
has_many :versions, class_name: 'AppVersion', dependent: :destroy
has_many :secondary_tokens, dependent: :destroy
has_many :apps, through: :secondary_tokens
# business logic
end # user.rb
class User < ActiveRecord::Base
belongs_to :account
has_many :devices, dependent: :destroy
# This allows a user to see any apps that is provided via roles
has_many :apps_provided_by_roles, source: :apps, through: :account_roles
has_and_belongs_to_many :apps
has_and_belongs_to_many :account_roles
# business logic
end # backtrace
Showing /vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/app/views/active_admin/resource/index.html.arb where line #1 raised:
undefined method `apps_users_id_eq' for Ransack::Search<class: App, base: Grouping <combinator: and>>:Ransack::Search
Extracted source (around line #1):
1
insert_tag renderer_for(:index)
Rails.root: REDACTED
Application Trace | Framework Trace | Full Trace
vendor/bundler/gems/ransack-1.2.3/lib/ransack/search.rb:86:in `method_missing'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/tags/base.rb:28:in `value'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/tags/select.rb:16:in `block in render'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/tags/select.rb:16:in `fetch'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/tags/select.rb:16:in `render'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/form_options_helper.rb:165:in `select'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/form_options_helper.rb:779:in `select'
vendor/bundler/gems/formtastic-2.3.0.rc3/lib/formtastic/inputs/select_input.rb:154:in `select_html'
vendor/bundler/gems/formtastic-2.3.0.rc3/lib/formtastic/inputs/select_input.rb:149:in `block in to_html'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
vendor/bundler/gems/haml-4.0.5/lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/capture_helper.rb:38:in `capture'
vendor/bundler/gems/haml-4.0.5/lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/inputs/filter_base.rb:11:in `input_wrapping'
vendor/bundler/gems/formtastic-2.3.0.rc3/lib/formtastic/inputs/select_input.rb:146:in `to_html'
vendor/bundler/gems/formtastic-2.3.0.rc3/lib/formtastic/helpers/input_helper.rb:241:in `input'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/form_builder.rb:26:in `block in input'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/form_builder.rb:150:in `with_new_form_buffer'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/form_builder.rb:26:in `input'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/filters/forms.rb:16:in `filter'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/filters/forms.rb:71:in `block (2 levels) in active_admin_filters_form_for'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/filters/forms.rb:67:in `each'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/filters/forms.rb:67:in `block in active_admin_filters_form_for'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
vendor/bundler/gems/haml-4.0.5/lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/capture_helper.rb:38:in `capture'
vendor/bundler/gems/haml-4.0.5/lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/helpers/form_helper.rb:434:in `form_for'
vendor/bundler/gems/haml-4.0.5/lib/haml/helpers/action_view_mods.rb:139:in `form_for_with_haml'
vendor/bundler/gems/haml-4.0.5/lib/haml/helpers/action_view_xss_mods.rb:28:in `form_for_with_haml_xss'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/filters/forms.rb:66:in `active_admin_filters_form_for'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element.rb:175:in `method_missing'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/filters/resource_extension.rb:128:in `block in filters_sidebar_section'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/components/sidebar_section.rb:20:in `instance_exec'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/components/sidebar_section.rb:20:in `build_sidebar_content'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/components/sidebar_section.rb:13:in `build'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:92:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:26:in `build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:39:in `insert_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:14:in `sidebar_section'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:122:in `block (2 levels) in build_sidebar'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:121:in `collect'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:121:in `block in build_sidebar'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:92:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:26:in `build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:39:in `insert_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:14:in `div'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:120:in `build_sidebar'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:66:in `block in build_page_content'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:92:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:26:in `build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:39:in `insert_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:14:in `div'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:64:in `build_page_content'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:47:in `block (2 levels) in build_page'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:92:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:26:in `build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:39:in `insert_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:14:in `div'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:44:in `block in build_page'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:92:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:43:in `build_page'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/lib/active_admin/views/pages/base.rb:10:in `build'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:92:in `with_current_arbre_element'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:26:in `build_tag'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/element/builder_methods.rb:39:in `insert_tag'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/app/views/active_admin/resource/index.html.arb:1:in `block in _vendor_bundler_bundler_gems_active_admin_cf_b_f__ab_e_app_views_active_admin_resource_index_html_arb__9397484507466979_70309021550460'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:45:in `instance_eval'
vendor/bundler/gems/arbre-1.0.1/lib/arbre/context.rb:45:in `initialize'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/app/views/active_admin/resource/index.html.arb:1:in `new'
vendor/bundler/bundler/gems/active_admin-cf3b1f70ab0e/app/views/active_admin/resource/index.html.arb:1:in `_vendor_bundler_bundler_gems_active_admin_cf_b_f__ab_e_app_views_active_admin_resource_index_html_arb__9397484507466979_70309021550460'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/template.rb:145:in `block in render'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications.rb:161:in `instrument'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/template.rb:339:in `instrument'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/template.rb:143:in `render'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications.rb:159:in `block in instrument'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications.rb:159:in `instrument'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/template_renderer.rb:54:in `block in render_template'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/template_renderer.rb:53:in `render_template'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/template_renderer.rb:17:in `render'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/renderer/renderer.rb:23:in `render'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/rendering.rb:99:in `_render_template'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/rendering.rb:82:in `render_to_body'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/renderers.rb:32:in `render_to_body'
vendor/bundler/gems/actionpack-4.1.1/lib/abstract_controller/rendering.rb:25:in `render'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/rendering.rb:16:in `render'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:41:in `block in render'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
vendor/bundler/gems/activerecord-4.1.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:40:in `render'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/responder.rb:238:in `default_render'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/responder.rb:165:in `to_html'
vendor/bundler/gems/responders-1.0.0/lib/responders/flash_responder.rb:104:in `to_html'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/responder.rb:158:in `respond'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/responder.rb:151:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/mime_responds.rb:400:in `respond_with'
vendor/bundler/gems/inherited_resources-1.4.1/lib/inherited_resources/actions.rb:7:in `index'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
vendor/bundler/gems/actionpack-4.1.1/lib/abstract_controller/base.rb:189:in `process_action'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
vendor/bundler/gems/actionpack-4.1.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:113:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:113:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:229:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:229:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:229:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:229:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:86:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:86:in `run_callbacks'
vendor/bundler/gems/actionpack-4.1.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications.rb:159:in `block in instrument'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/notifications.rb:159:in `instrument'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
vendor/bundler/gems/activerecord-4.1.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
vendor/bundler/gems/actionpack-4.1.1/lib/abstract_controller/base.rb:136:in `process'
vendor/bundler/gems/actionview-4.1.1/lib/action_view/rendering.rb:30:in `process'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal.rb:195:in `dispatch'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
vendor/bundler/gems/actionpack-4.1.1/lib/action_controller/metal.rb:231:in `block in action'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:80:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:48:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/journey/router.rb:71:in `block in call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/journey/router.rb:59:in `each'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/journey/router.rb:59:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:676:in `call'
vendor/bundler/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:186:in `call!'
vendor/bundler/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:164:in `call'
vendor/bundler/gems/omniauth-1.2.1/lib/omniauth/builder.rb:59:in `call'
vendor/bundler/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
vendor/bundler/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
vendor/bundler/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/flash.rb:254:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
vendor/bundler/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/cookies.rb:560:in `call'
vendor/bundler/gems/activerecord-4.1.1/lib/active_record/query_cache.rb:36:in `call'
vendor/bundler/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
vendor/bundler/gems/activerecord-4.1.1/lib/active_record/migration.rb:380:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:82:in `run_callbacks'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/reloader.rb:73:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
vendor/bundler/gems/railties-4.1.1/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundler/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `block in call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:26:in `tagged'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `tagged'
vendor/bundler/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `call'
vendor/bundler/gems/quiet_assets-1.0.2/lib/quiet_assets.rb:18:in `call_with_quiet_assets'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
vendor/bundler/gems/activesupport-4.1.1/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
vendor/bundler/gems/actionpack-4.1.1/lib/action_dispatch/middleware/static.rb:64:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
vendor/bundler/gems/railties-4.1.1/lib/rails/engine.rb:514:in `call'
vendor/bundler/gems/railties-4.1.1/lib/rails/application.rb:144:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
vendor/bundler/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
vendor/bundler/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call'
vendor/bundler/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
|
@Lordnibbler same problem =( |
+1 for this. I'm having the same problem. |
Same probleme here. # movie_option.rb
class MovieOption < ActiveRecord::Base
has_and_belongs_to_many :movies
end # movie.rb
class Movie < ActiveRecord::Base
has_and_belongs_to_many :options, class_name: 'MovieOption'
#...
end # error
undefined method `movies_options_id_eq' for Ransack::Search<class: Movie, base: Grouping <combinator: and>>:Ransack::Search |
@dgellow just a dumb question, but could you possibly go with the following to move away from a HABTM approach?
And then leave in the ID column in the movie_options table? This would ensure that the id_eq responds correctly, and also allow you to add any additional metadata you'd like to the movie_option entry that joins the two entries. |
I am having the same problem with a HABTM. Any news on that? |
+1 - having the same issue with HABTM relationships. For every model that has one, rendering the page fails. |
+1 also having same problem on gem 'activeadmin', github: 'gregbell/active_admin' |
look like the problem is appear only with rails-4.1.1, versions rails-4.0.8 and rails 4.1.2+ work fine for me. Using ransack-1.2.3 difference between result 4.0.8 {:profiles_items=>{}, :items=>{}, :slug=>{}, :first_name=>{}, :last_name=>{}, :completed=>{}, :created_at=>{}, :updated_at=>{}} 4.1.1: {:items=>{}, :slug=>{}, :first_name=>{}, :last_name=>{}, :completed=>{}, :created_at=>{}, :updated_at=>{}} look like "profiles_items" is excess # in resource code
config.filters.each {|name,value| remove_filter(name) if name.match /#{config.resource_table_name.gsub('"','')}_*/ } P.S with rails 4.1.2-4.1.4 active_admin filters work fine, but thinking_sphinx have a problem with HABTM relations |
Hi there Greg. I saw the problem in Rails 4.0.5 What was the version of Ransack::Search in the two above instances? On 6 July 2014 18:26, wild notifications@github.com wrote:
Joel Courtney t: http://twitter.com/jufemaiz |
Same problem here as of revision 2736099 with rails 4.1.4. Did a workaround as specified on #2565 (comment) |
I'm also running into this. Is anyone working on a fix? Looks like it will be included in 1.0.0. Is that correct and if so when will that become available? Looks like its 5 months past due. |
BTW - I don't know if any of you have stumbled on to this before but just defining the filter fixes the problem. Just found that out by experimenting more. |
Hi, Thanks in advance for any help. I am getting an error when using active admin in my 'rails 4.1.4' application. This model does not have any associations. Has anyone encountered this before? Thanks again! Error: Model: Schema: |
@tmclark737 ActiveAdmin / Ransack have a problem with columns that ends with If that doesn't work, please open a new issue, I think that is not related to this one. |
timoschilling! Thanks for the quick reply! I will try it out right now. |
Can someone that has this problem, please check that is still exists, with current ransack master? |
@tmclark737 ActiveAdmin should now work with filters that ends with |
Sweet! Thanks Timo. =) On Thu, Nov 13, 2014 at 4:11 PM, Timo Schilling notifications@github.com
Ty Clark PE |
Ransack had some problems in the past, wich ends in error like:
While here is no activity since a while, I'm going to close this. If someone has problems like this please open a new issue |
thanks u @seanlinsley |
Thanks! For me it was remove_filter :user |
Error: undefined method `users_user_id_eq' for Ransack::Search<class: Detail, base: Grouping <combinator: and>>:Ransack::Search
Rails 4, Ruby 2. Latest version of Active Admin.
Added basic admin functionality to a model I have called Detail. Not sure what is going on or what info might be needed to troubleshoot the bug.
Thanks for any help.
The text was updated successfully, but these errors were encountered: