-
Notifications
You must be signed in to change notification settings - Fork 921
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
Unknown key :on #939
Comments
+1. I am facing this issue too. |
What is the Edit: The |
That said, the edge guide still shows using the |
@knirirr @mlh758 @shrirambalakrishnan This might be the fix for this issue #940. |
That PR trades The |
@mlh758, it seems to work just fine, I made a monkey patch for this issue as a workaround based on this PR #940
|
They don't do the same thing though. The if filter executes a predicate method and then continues with the operation if that method returns something truthy. In your monkey patch that means it calls |
I created a Rails 6.0.0 RC1 project, made a Widget model like this: class Widget < ApplicationRecord
before_validation :normalize_name, on: :create
def normalize_name
self.name = name.underscore.downcase
end
end Then ran:
If I change that line to Then try the above sequence of commands I get:
This also shows that |
Found this mentioned in rails/rails#35329 Introduced in rails/rails#30919 I don't see anything obviously wrong with how we're using it here though: class Widget < ApplicationRecord
after_commit :log_name, on: :destroy
def log_name
puts name
end
end does what you would expect and only logs the name when a Widget is destroyed. No errors. |
Have you overridden the default Edit: I'm dumb, our default is Alternatively, could we remove the |
* Fix sunspot#939 rails/30919 added strict callback checking for Rails 6. The on callback used to be ignored on our default callback. It now raises an error. This change checks the configured callback and conditionally adds the on filter. * Simplify regex, use different regex operator
* Fix sunspot#939 rails/30919 added strict callback checking for Rails 6. The on callback used to be ignored on our default callback. It now raises an error. This change checks the configured callback and conditionally adds the on filter. * Simplify regex, use different regex operator
On setting up a new application (Rails 6.0.0-rc1) I can't start/stop/reindex sunspot, even with a simple configuration like this in my model:
This results in:
ArgumentError: Unknown key: :on. Valid keys are: :if, :unless, :prepend
The location of the problem would appear to be here:
https://github.com/sunspot/sunspot/blob/master/sunspot_rails/lib/sunspot/rails/searchable.rb#L104
Indeed, if I change :on to :if then I can start/reindex etc. The question is whether this is appropriate to do.
The text was updated successfully, but these errors were encountered: