You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
597 B
25 lines
597 B
|
|
class Ability |
|
include CanCan::Ability |
|
|
|
def initialize(user) |
|
clear_aliased_actions |
|
|
|
user ||= User.new |
|
end |
|
|
|
def clear_aliased_actions |
|
super |
|
|
|
# override cancan default aliasing (we don't want to differentiate |
|
# between read and index) |
|
alias_action :destroy, to: :delete |
|
alias_action :edit, to: :update |
|
alias_action :new, to: :create |
|
alias_action :show, to: :read |
|
alias_action :search, to: :index |
|
alias_action :index, :read, to: :display |
|
alias_action :create, :update, to: :modify |
|
alias_action :display, :modify, to: :basic_manage |
|
end |
|
end |