Class: Wobauth::AuthoritiesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wobauth/authorities_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability

Instance Method Details

#createObject

POST /authorities



37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/wobauth/authorities_controller.rb', line 37

def create
  myparams = authorized_for_params.merge(authority_params)
  if @authorizable.present?
    @authority = @authorizable.authorities.new(myparams)
  else
    @authority = Authority.new(myparams)
  end

  @authority.save
  respond_with(@authority, location: location)
end

#destroyObject

DELETE /authorities/1



56
57
58
59
# File 'app/controllers/wobauth/authorities_controller.rb', line 56

def destroy
  @authority.destroy
  respond_with(@authority, location: location)
end

#editObject

GET /authorities/1/edit



33
34
# File 'app/controllers/wobauth/authorities_controller.rb', line 33

def edit
end

#indexObject

GET /authorities



12
13
14
15
# File 'app/controllers/wobauth/authorities_controller.rb', line 12

def index
  @authorities = Authority.accessible_by(current_ability, :read)
  respond_with(@authorities)
end

#newObject

GET /authorities/new



23
24
25
26
27
28
29
30
# File 'app/controllers/wobauth/authorities_controller.rb', line 23

def new
  if @authorizable.present?
    @authority = @authorizable.authorities.new(authorized_for_params)
  else
    @authority = Authority.new(authorized_for_params)
  end
  respond_with(@authority)
end

#showObject

GET /authorities/1



18
19
20
# File 'app/controllers/wobauth/authorities_controller.rb', line 18

def show
  respond_with(@authority)
end

#updateObject

PATCH/PUT /authorities/1



50
51
52
53
# File 'app/controllers/wobauth/authorities_controller.rb', line 50

def update
  @authority.update(authority_params)
  respond_with(@authority, location: location)
end