Sha256: bf59cb4e28a207b4f73b36618f66f86fe6b0f52640eef9e977ed902b356e204e

Contents?: true

Size: 393 Bytes

Versions: 6

Compression:

Stored size: 393 Bytes

Contents

<% module_namespacing do -%>
class <%= class_name %>Policy < <%= parent_class_name %>

  def canner_scope
    case @method
    when :index
      # Add any special scoping you might need here
      <%= class_name %>.all
    else
      <%= class_name %>.none
    end
  end

  def can?
    case @method
    when :index
      # has_role?(:admin)
    else
      false
    end
  end

end
<% end -%>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
canner-0.4.0 lib/generators/canner/policy/templates/policy.rb
canner-0.3.0 lib/generators/canner/policy/templates/policy.rb
canner-0.2.2 lib/generators/canner/policy/templates/policy.rb
canner-0.2.1 lib/generators/canner/policy/templates/policy.rb
canner-0.2.0 lib/generators/canner/policy/templates/policy.rb
canner-0.1.0 lib/generators/canner/policy/templates/policy.rb