Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # controller for group/customers
- def index
- @customers = current_user.available_customers(param[:group_id].to_i)
- end
- # user
- def available_customers(group_id)
- # some other code, that sometimes returns early
- # this is the line of failure
- # self.accessible_group_ids returns an array of integers
- # as does Group.children_ids
- # This line is attempting to get the subset of group ids that the user
- # is *allowed* to touch, and the hierarchy of group ids under the selected one.
- ids = (self.accessible_group_ids & ([group_id] + Group.children_ids(group_id)))
- return Customer.where(group_id: ids)
- end
- def available_customers(group_id)
- # nil handling
- group_id = group_id.to_i
- # everything else
- end
Add Comment
Please, Sign In to add comment