Closed perkins2099 closed 10 years ago
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 belongs_to
a User?
The structure of that method (users_user_id_eq
) reminds me of the has_many :through
functionality added in #2541
I did at one point(In another admin .rb file) but took them out as I didn't need them any more. Perhaps the relation is too complicated? Detail has many users..through competitors. Competitors has_many details through competitor details.. Competitor belongs_to a user.
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 has_many :through
relationships. For now, you can just remove that filter:
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 wwtd
right now. I'll submit a pull request if it passes.
@perkins2099 Can you set the filter to filter :users, as: :check_boxes
and tell me the error message, if any?
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. B has many C. A has many C through B.
C has many D. D has many E. C has many E through 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:
Bs_C_id_eq
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:
Bs_Cs_Ds_E_id_eq
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 Reflection#chain
:heart:
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.
undefined method `bs_cs_ds_e_id_eq' for Ransack::Search<class: A, base: Grouping <combinator: and>>:Ransack::Search
@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?
gem 'activeadmin', github: 'shekibobo/active_admin', branch: '2565-fix-nested-through-filters'
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 has_many :through
because the foreign key we are search on is an actual attribute of the direct association. So, just like we can search by :association_name_eq
, we can search by :association_other_foreign_key_eq
. So simple.
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
Showing ~/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-ec00dc24600a/app/views/active_admin/resource/index.html.arb where line #1 raised:
undefined method `patient_plan_patient_plan_id_eq' for Ransack::Search<class: Patient, base: Grouping <combinator: and>>:Ransack::Search
seems to be caused by a has_many through:
@bughit Can you show me how the patient plan relationship is defined?
@bughit Can you show me how you've defined the relationship for patient_plan
? Can you also try using ref b9ab2507dff0bea743a1595ee880d13280425492?
gem 'activeadmin', github: 'shekibobo/active_admin', ref: 'b9ab2507dff0bea743a1595ee880d13280425492'
Let me know if that one works. Thanks.
b9ab2507dff0bea743a1595ee880d13280425492 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, has_many :patient_plan_goal_actions, through: :patient_plan_goals
but it's the has_many in the previous post that's the current culprit
I guess I hadn't considered a has_one :through
case. I'll take a look at this tonight.
not has_one through:
although that's also possible and should work, but has_many through: :has_one_association
this is about the source: association of a through:, which I think can be nearly anything (has_one, has_many, belongs_to, and the through varieties, not sure about HABTM). I am guessing you tested only through: has_many
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
the docs don't seem to have an exhaustive list of possible source associations, I suppose the right thing would be to make sure that all possible supported combinations work with aa
@bughit I'm going to push up another branch to have you test.
gem 'activeadmin', github: 'shekibobo/active_admin', branch: 'test-through-has-one'
not sure if I was supposed to wait, but just tried it (revision: 5c9a27b3c7f86ee472d63f35f76ce21b647dc60d), still a problem
I can't get this to happen here. The basic setup for how we handle the has_* :through
filtering is to grab all the associations, get rid of any that have a chain longer than 2, and then, if it's a through association, use the through association name and the foreign key for the end association.
What this suggests to me is that you have an association like so:
has_one :patient_plan
has_* :patient_plans, through: :patient_plan
PatientPlan should have a belongs_to :main_model
and a belongs_to :patient_plan_goal
Wait.
Does your PatientPlan
model look like this?
class PatientPlan < ActiveRecord::Base
belongs_to :patient, inverse_of: :patient_plan
has_many :patient_plan_goals
end
?
class PatientPlan < ActiveRecord::Base
belongs_to :patient, inverse_of: :patient_plan
has_many :patient_plan_goals, inverse_of: :patient_plan, dependent: :destroy
has_many :patient_plan_goal_actions, through: :patient_plan_goals
end
Well that's the problem. The through model doesn't have the attribute for the joined model, thus can't be searched by ransack.
I found a fun method called ransackable_associations
, but that doesn't actually seem to filter out the associations we're having troubles with.
@bughit I just pushed another one to my working branch. Could you try this one out if it passes travis?
gem 'activeadmin', github: 'shekibobo/active_admin', branch: '2565-fix-nested-through-filters'
yes, PatientPlan is not a join model, which should not be required, :through is a general purpose association forwarder.
Uncaught exception: ~/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-b98df9ff9908/lib/active_admin/filters/formtastic_addons.rb:46: syntax error, unexpected tIDENTIFIER, expecting keyword_end
...ackable_attributes.include? ref.foreign_key if ref
Yeah, it's just that Ransack can't search through more than one associated model, and it can only search attributes on that single join model. At least so far as I understand the gem so far. So we just can't automatically build named filters for associations that don't follow the ransack-searchable patterns.
I think I fixed the parentheses issue in the error above (I think) if you want to try again. Hoping it passes travis this time.
working now, thanks
awesome!
Thanks for testing it out!
Okay, this should now be fixed on master :]
Can you confirm that the fix is still operational?
I have a has_many :through relationship that is showing the same issues as above.
@jufemaiz can you post the stack trace?
undefined method `measurement_data_id_eq' for #<Ransack::Search:0x000001a12124e0>
Hmmmm… Actually thinking more about it it's due to the lack of an ID column on this particular table (timeseries data, odd import times etc). At this stage it's embedded within the prod db but I'm looking to migrate it out (off topic).
However the server does hang for considerable periods of time before coming back with that. I assume that the lack of ID column would be part of that problem?
@jufemaiz the hanging could be related to a bug in the latest release of Arbre. Using github: 'gregbell/arbre'
might fix the hanging problem.
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 list
has_many domains
through list_domains
, and list_domains
has a primary key on [list_id,domain_id]
. I'm trying to assign those associations using a nested has_many :list_domains
under the list form in active admin, and I'm getting this error:
undefined method 'list_domains_id_eq' for Ransack::Search<class: List, base: Grouping <combinator: and>>:Ransack::Search
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 has_many :list_domains
line in my List
model, ActiveAdmin functions normally. As soon as I uncomment that line, I get the error above.
I am also seeing this issue still, and have had to invoke remove_filter
for all of my HABTM relationships.
# 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
Error: undefined method `users_user_id_eq' for Ransack::Search<class: Detail, base: Grouping>: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.