-
Notifications
You must be signed in to change notification settings - Fork 405
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
use of dynamic finders defines respond_to? method #158
Comments
Thanks for the feedback. def respond_to?(method, include_private = false)
if Rolify.dynamic_shortcuts && (method.to_s.match(/^is_(\w+)_of[?]$/) || method.to_s.match(/^is_(\w+)[?]$/))
query = self.class.role_class.where(:name => $1)
query = self.class.adapter.exists?(query, :resource_type) if method.to_s.match(/^is_(\w+)_of[?]$/)
return true if query.count > 0
end
super
end |
@gitgary did you have a chance to try the workaround in my previous post ? |
Hi Florent Sorry for not responding sooner. Yes, I did try it and yes it seems to be working properly now. It certainly no longer crashes and appears ok. I plan to do a bit more detailed testing however. If I see any odd behavior, I'll be sure to post. Thanks! |
@EppO Hi, it seems I'm getting the same error here, can you tell me where I have to put the override code for respond_to? thank you |
…alse for custom model method names starts with is_ and ends with ?
…alse for custom model method names starts with is_ and ends with ?
This problem has a simple solution -- keep 'config.use_dynamic_shortcuts' commented out in the initializer, but I thought I would at least pass on the info.
When one turns on dynamic finders, it defines a 'respond_to?' method which conflicts with a method of the same named used within other gems like 'socialization'. The result is that the 'rolify' version of respond_to? gets called and causes the other code to fail.
Sorry, but I'm not precisely sure what the best way to fix this myself otherwise, I'd submit some code, but I wanted to let you know.
The text was updated successfully, but these errors were encountered: