Open vfonic opened 7 years ago
@vfonic I'm seeing this error myself today, did you ever find a workaround for it?
No, ended up not needing it.
On May 9, 2017 19:50, "Robert Rawlins" notifications@github.com wrote:
@vfonic https://github.com/vfonic I'm seeing this error myself today, did you ever find a workaround for it?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/activerecord-hackery/ransack/issues/756#issuecomment-300152728, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEHbQ8u1I4W2dDgLX0o0Lg8yebUH6V7ks5r4GEugaJpZM4L06Hv .
@seanfcarroll I'm trying to find a PR that fixes this. Was this fixed?
Or is there any reason for closing unresolved issues, with full repro steps and an example project?
@vfonic sorry I thought it was not needed. I'm trying to clean up the many issues in Ransack. If it's still there can you submit a repo or a pull request with failing tests? It will make my job a little easier ...
Cheers
@seanfcarroll this is the repo: https://github.com/vfonic/ransacked
It has a spec written in the repo. I don't have any time atm to make it into a spec directly in the ransack repo. Sorry!
Thanks a lot!
I caught this bug a while ago. However, I used ransack_alias instead of ransackable_attributes. Likewise, it seems to happen when traversing relationships.
I'm also facing the same issue.
added a method in a model like this
def self.ransackable_attributes(auth_object = nil)
%w[orderId]
end
Output
#<ActionController::Parameters {"orderId_eq"=>"3"} permitted: false>
(byebug) @orders.ransack(params[:query])
*** NoMethodError Exception: undefined method `type' for nil:NilClass
nil
any solution for this.
Hi!
I think ransackable_attributes
is expected to only include column names, not association names, ransackable_associations
should be the one to override for associations. Changing the ransackable_attributes
in the original repro to return an empty array fixes the issue.
I guess we should add some validation here?
Hi,
Here's a sample project:
Running:
Results in:
When I remove
ransackable_attributes
, the search works as expected.Line 32 of
context.rb
:schema_cache.columns_hash(table)[name].type
I've attached debugger and evaluated the variables:
Hope it helps.
I also created a sample project that shows this error: https://github.com/vfonic/ransacked
When you clone the project, run: