-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Cannot visit Range #32
Comments
Can you provide a stack trace? |
arel (2.2.1) lib/arel/visitors/visitor.rb:25:in |
I'm having the same issue. Trying to generate a BETWEEN query for two dates by using the "in" arel predicate and passing a Range. Did you ever figure anything out with this? Thanks! |
The problem seems to be that by using the When it actually calls Arel to build the query, the |
Hey guys, patches/specs appreciated on this one. Or, better yet, see https://twitter.com/erniemiller/status/167289641295294464 and nominate a possible maintainer? :) |
I'll do my best to get a patch & spec to allow for date ranges to work properly. However, I wouldn't be a good candidate to maintain this gem as it's a little out of my skill range. I don't think I'd be able to do it justice. You've set a nice, high bar with this one ;) Really great gem. |
Anybody found a fix or workaround for this? |
Same problem here, need to generate a custom predicate which producses a BETWEEN for two values, anybody has a hint how to solve the problem |
Same problem. Ended up with ugly but working solution. Using the code provided by issue starter: module Ransack
class Predicate
attr_accessor :wants_array
end
end
Ransack.configure do |config|
config.add_predicate 'btw',
:arel_predicate => 'in',
:formatter => proc {|v| Range.new(Date.today, Date.today+1)}
end
Ransack::predicates['btw'].wants_array = false I.e. just forcing "wants_array" to "false" after creating predicate. |
@pavlitsky 's hack works, but it'd be nice to have a way to do this without such a hack... |
Thanks for the hints. Here's a slightly terser way (without the monkey patch of the
I'm just working on a PR to allow the same functionality to be achieved by passing
|
Hi,
I'm trying to use a custom predicate, but I get always the same error.
Ransack.configure do |config|
config.add_predicate 'btw',
:arel_predicate => 'in',
:formatter => proc {|v| Range.new(Date.today, Date.today+1)}
end
Thanks,
Carlos
The text was updated successfully, but these errors were encountered: