Class: PagesController
Instance Method Summary
collapse
included
#current_ability
#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets
included
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/pages_controller.rb', line 20
def create
@page = Page.new(params[:page])
@page.user = current_user
if @page.save
redirect_to @page, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
45
46
47
48
49
|
# File 'app/controllers/pages_controller.rb', line 45
def destroy
@page = Page.find(params[:id])
@page.destroy
redirect_to pages_url, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
31
32
33
|
# File 'app/controllers/pages_controller.rb', line 31
def edit
@page = Page.find(params[:id])
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/pages_controller.rb', line 8
def index
@pages = Page.order_by(name: 'ASC')
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/pages_controller.rb', line 16
def new
@page = Page.new
end
|
#resource ⇒ Object
51
52
53
|
# File 'app/controllers/pages_controller.rb', line 51
def resource
@page
end
|
#show ⇒ Object
12
13
14
|
# File 'app/controllers/pages_controller.rb', line 12
def show
@page = Page.find(params[:id])
end
|
#update ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/pages_controller.rb', line 35
def update
@page = Page.find(params[:id])
if @page.update_attributes(params[:page])
redirect_to @page, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|