lib/trust/controller.rb in trust-0.6.1 vs lib/trust/controller.rb in trust-0.6.2

- old
+ new

@@ -187,10 +187,10 @@ # can? :edit # does the current user have permission to edit the current resource? # # If there is a nested resource, the parent is automatically associated # can? :edit, @customer # does the current user have permission to edit the given customer? # # Parent is also passed on here. # can? :edit, @account, @client # is current user allowed to edit the account associated with the client? - def can?(action_name, subject = resource.instance || resource.klass, parent = resource.parent) + def can?(action_name, subject = resource.instance || resource.relation.new, parent = resource.parent) Trust::Authorization.authorized?(action_name, subject, parent) end end end end