Class: CmsAdmin::SitesController
- Inherits:
-
BaseController
- Object
- BaseController
- CmsAdmin::SitesController
- Defined in:
- app/controllers/cms_admin/sites_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 21 def create @cms_site.save! flash[:notice] = 'Site created' redirect_to :action => :edit, :id => @cms_site rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to create site' render :action => :new end |
#destroy ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 39 def destroy @cms_site.destroy flash[:notice] = 'Site deleted' redirect_to :action => :index end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 17 def edit render end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 8 def index return redirect_to :action => :new if CmsSite.count == 0 @cms_sites = CmsSite.all end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 13 def new render end |
#update ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 30 def update @cms_site.update_attributes!(params[:cms_site]) flash[:notice] = 'Site updated' redirect_to :action => :edit, :id => @cms_site rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to update site' render :action => :edit end |