schrockwell/bodyguard

protocol Ecto.Queryable not implemented for []

zimt28 opened this issue · 3 comments

Hi!

I've been using policies so far and just tried to add scopes, however I get the following error:

protocol Ecto.Queryable not implemented for []
defmodule App.Case.Policy do
  import Ecto.Query

  def can?(_user, _action, _case), do: true

  def scope(_user, _action, scope), do: scope
end

All I've added is the following line (policies work fine for the same controller):

def index(conn, _params) do
  IO.inspect scope(conn, Case)
  # ...

I've looked at the documentation but couldn't find a difference, what's wrong with my code?

Thanks!

Looks like I'm getting empty lists for the scope param

Simple solution: I used the master Readme, but should have used https://github.com/schrockwell/bodyguard/tree/v0.5.0.

Yeah, sorry about that, I'm in the process of making some breaking API changes. Glad you figured it out.