Class: EtabliocmsActualities::Admin::ActualitiesController
- Inherits:
-
EtabliocmsCore::Admin::BaseController
- Object
- EtabliocmsCore::Admin::BaseController
- EtabliocmsActualities::Admin::ActualitiesController
- Defined in:
- app/controllers/etabliocms_actualities/admin/actualities_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/etabliocms_actualities/admin/actualities_controller.rb', line 13 def create @actuality = Actuality.new(params[:actuality]) if @actuality.save flash[:notice] = t('actuality.created') redirect_to :action => 'index' else render :action => 'new' end end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/etabliocms_actualities/admin/actualities_controller.rb', line 37 def destroy Actuality.find(params[:id]).destroy flash[:notice] = t('actuality.destroyed') redirect_to :action => 'index' end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/etabliocms_actualities/admin/actualities_controller.rb', line 23 def edit @actuality = Actuality.find(params[:id]) end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/etabliocms_actualities/admin/actualities_controller.rb', line 5 def index @actualities = Actuality.order(params[:order] || "created_at DESC").page(params[:page]) end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/etabliocms_actualities/admin/actualities_controller.rb', line 9 def new @actuality = Actuality.new end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/etabliocms_actualities/admin/actualities_controller.rb', line 27 def update @actuality = Actuality.find(params[:id]) if @actuality.update_attributes(params[:actuality]) flash[:notice] = t('actuality.updated') redirect_to :action => 'index' else render :action => 'edit' end end |