Class: CandidaturesController
Instance Method Summary
collapse
included
#current_ability
#voluntary_application_javascripts, #voluntary_application_repository_path, #voluntary_application_stylesheets
included
Instance Method Details
#create ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/candidatures_controller.rb', line 33
def create
@candidature = Candidature.new(params[:candidature])
@candidature.resource_type = 'User'
@candidature.resource_id = current_user.id
if @candidature.save
redirect_to @candidature, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
56
57
58
59
|
# File 'app/controllers/candidatures_controller.rb', line 56
def destroy
@candidature.destroy
redirect_to candidatures_url, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
45
46
|
# File 'app/controllers/candidatures_controller.rb', line 45
def edit
end
|
#index ⇒ Object
15
16
17
18
19
20
21
|
# File 'app/controllers/candidatures_controller.rb', line 15
def index
@candidatures = if @vacancy
@vacancy.candidatures.includes(:vacancy, :resource)
else
Candidature.includes(:vacancy, :resource).where(resource_type: 'User')
end
end
|
#new ⇒ Object
28
29
30
31
|
# File 'app/controllers/candidatures_controller.rb', line 28
def new
@candidature = Candidature.new
@candidature.vacancy = parent
end
|
#parent ⇒ Object
65
66
67
|
# File 'app/controllers/candidatures_controller.rb', line 65
def parent
@vacancy
end
|
#resource ⇒ Object
61
62
63
|
# File 'app/controllers/candidatures_controller.rb', line 61
def resource
@candidature
end
|
#show ⇒ Object
23
24
25
26
|
# File 'app/controllers/candidatures_controller.rb', line 23
def show
@vacancy = @candidature.vacancy
@comments = @candidature.
end
|
#update ⇒ Object
48
49
50
51
52
53
54
|
# File 'app/controllers/candidatures_controller.rb', line 48
def update
if @candidature.update_attributes(params[:candidature])
redirect_to @candidature, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|