Class: ProfessionsController

Inherits:
ApplicationController show all
Includes:
Applicat::Mvc::Controller::Resource
Defined in:
app/controllers/professions_controller.rb

Instance Method Summary collapse

Methods included from Applicat::Mvc::Controller::Resource

included

Methods inherited from ApplicationController

#current_ability

Methods included from Voluntary::V1::BaseController

#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets

Methods included from Applicat::Mvc::Controller

included

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/professions_controller.rb', line 28

def create
  @profession = Profession.new(params[:profession])
  
  if @profession.save
    redirect_to @profession, notice: t('general.form.successfully_created')
  else
    render :new
  end
end

#destroyObject



49
50
51
52
# File 'app/controllers/professions_controller.rb', line 49

def destroy
  @profession.destroy
  redirect_to professions_url, notice: t('general.form.destroyed')
end

#editObject



38
39
# File 'app/controllers/professions_controller.rb', line 38

def edit
end

#indexObject



12
13
14
15
16
17
18
19
# File 'app/controllers/professions_controller.rb', line 12

def index
  @professions = Profession.order(:name)
    
  respond_to do |format|
    format.html
    format.json { render json: @professions.tokens(params[:q]) }
  end
end

#newObject



24
25
26
# File 'app/controllers/professions_controller.rb', line 24

def new
  @profession = Profession.new
end

#resourceObject



54
55
56
# File 'app/controllers/professions_controller.rb', line 54

def resource
  @profession
end

#showObject



21
22
# File 'app/controllers/professions_controller.rb', line 21

def show
end

#updateObject



41
42
43
44
45
46
47
# File 'app/controllers/professions_controller.rb', line 41

def update
  if @profession.update_attributes(params[:profession])
    redirect_to @profession, notice: t('general.form.successfully_updated')
  else
    render :edit
  end
end