Cannot use accessible_by(current_ability), to be able to filter my index according to the role #938

Open
mostafahussein opened this Issue Sep 18, 2013 · 1 comment

Projects

None yet

2 participants

@mostafahussein

I am trying to filter the index according to the ability. I am using the wice_grid gem to make a table in the index, and to add a condition to tickets, we could use something called :conditions https://github.com/leikind/wice_grid#conditions.

I have tried to put it like that:

@tickets_grid = initialize_grid(Ticket, :include => [:user, :employee_department, :state], :conditions => [Ticket.accessible_by(current_ability)])

This is not working, though. I'm looking for any suggestions.

@graywh
graywh commented Feb 7, 2014

@Code-Vortex

https://github.com/leikind/wice_grid#basics

Use a scope (relation) in place of the class instead of a conditions hash.

@tickets_grid = initialize_grid(Ticket.accessible_by(current_ability), :include => [:user, :employee_department, :start])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment