Skip to content
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

Named scoped does not define a without_* scope #210

Closed
kapso opened this issue Sep 6, 2015 · 1 comment
Closed

Named scoped does not define a without_* scope #210

kapso opened this issue Sep 6, 2015 · 1 comment

Comments

@kapso
Copy link

kapso commented Sep 6, 2015

Looks like if you define a named scope, it skips the negative/without scope. Why is that?

if options[:scope] == true
define_singleton_method "without_#{name}" do |*values|
values = enumerized_attributes[name].find_values(*values).map(&:value)
where(arel_table[name].not_in(values))
end
end

@nashby
Copy link
Member

nashby commented Jan 12, 2016

@kapso it's kinda hard properly name negative scope if you passed a name for a "with" scope. E.g if named it by_status naming negative scope without_by_status won't be that smart. Feel free to suggest an idea how to fix that (you can even send a PR!). Thanks!

@nashby nashby closed this as completed Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants