Class: Plum::Cp::GlobalsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Plum::Cp::GlobalsController
- Defined in:
- app/controllers/plum/cp/globals_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 20 def create @global = current_site.globals.build(global_params) if assign_data(@global) && @global.save redirect_to cp_global_path(@global), notice: "Global created" else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
43 44 45 46 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 43 def destroy @global.destroy redirect_to cp_globals_path, notice: "Global deleted" end |
#edit ⇒ Object
30 31 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 30 def edit end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 9 def index @globals = current_site.globals.order(:name) end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 16 def new @global = current_site.globals.build(data: {}) end |
#show ⇒ Object
13 14 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 13 def show end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/plum/cp/globals_controller.rb', line 33 def update @global.assign_attributes(global_params) if assign_data(@global) && @global.save redirect_to cp_global_path(@global), notice: "Global updated" else render :edit, status: :unprocessable_entity end end |