Sha256: f7440b9c0a22263fc18fa595fa99be39f5c9f361b67a434653f3e7aa9b89f711

Contents?: true

Size: 631 Bytes

Versions: 11

Compression:

Stored size: 631 Bytes

Contents

# @author Lovell McIlwain
#
# Authorization for article objects
class <%= options[:name].camelize %>Policy < ApplicationPolicy
  # Allow all users to access new article objects
  def new?
    true
  end

  # Allows owner of an article to edit the article
  def edit?
    user == record.user
  end

  # Allows all users to create article objects
  alias_method :create?, :new?

  # Allows all users to view article objects
  alias_method :show?, :new?

  # Allows owner of an article to update an article object
  alias_method :update?, :edit?

  # Allows owner of an object to remove an object
  alias_method :destroy?, :edit?
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
myrails-3.0.0 lib/myrails/templates/rails/pundit.rb
myrails-2.2.2 lib/myrails/templates/rails/pundit.rb
myrails-2.2.1 lib/myrails/templates/rails/pundit.rb
myrails-2.2.0 lib/myrails/templates/rails/pundit.rb
myrails-2.1.0 lib/myrails/templates/rails/pundit.rb
myrails-2.0.0 lib/myrails/templates/rails/pundit.rb
myrails-1.1.1 lib/myrails/templates/rails/pundit.rb
myrails-1.1.0 lib/myrails/templates/rails/pundit.rb
myrails-1.0.2 lib/myrails/templates/rails/pundit.rb
myrails-1.0.1 lib/myrails/templates/rails/pundit.rb
myrails-1.0.0 lib/myrails/templates/rails/pundit.rb