Class: GacoCms::Admin::PagesController
- Inherits:
-
BaseController
- Object
- GacoCms::AdminController
- BaseController
- GacoCms::Admin::PagesController
- Defined in:
- app/controllers/gaco_cms/admin/pages_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/gaco_cms/admin/pages_controller.rb', line 18 def create page = @page_type.pages.new(page_params) if page.save redirect_to url_for(action: :edit, id: page), notice: 'Page created' else render inline: page.errors..join(', ') end end |
#destroy ⇒ Object
37 38 39 40 |
# File 'app/controllers/gaco_cms/admin/pages_controller.rb', line 37 def destroy @page.destroy! redirect_to url_for(action: :index), notice: 'Page destroyed' end |
#edit ⇒ Object
27 |
# File 'app/controllers/gaco_cms/admin/pages_controller.rb', line 27 def edit; end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/gaco_cms/admin/pages_controller.rb', line 10 def index @pages = @page_type.pages.title_ordered end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/gaco_cms/admin/pages_controller.rb', line 14 def new @page = @page_type.pages.new end |
#update ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/controllers/gaco_cms/admin/pages_controller.rb', line 29 def update if @page.update(page_params) render inline: '' else render inline: @page.errors..join(', ') end end |