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
Added restrictions to show assigned tab
#103
Conversation
This reverts commit 84dee81.
plugin.rb
Outdated
add_to_class(:group, :can_show_assigned_tab?) do | ||
users = User.joins("JOIN group_users gu on users.id=gu.user_id").where("gu.group_id=?", self.id) | ||
|
||
users.each do |u| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be thousands of users here, so we can't afford to load them into memory and loop over them. We will need to write a single SQL query which does the check.
@davidtaylorhq The query worked awesomely😍, learned something new from this😅 |
Great! Glad it worked 😁 Looks like travis is failing on this. And also we should add an rspec check method to make sure the new query keeps working correctly in future. |
No description provided.