Sha256: b28e7f2ea2a77f99e781819417a59a279da10fbad548d4df860e8ccb9379bc5f
Contents?: true
Size: 1.09 KB
Versions: 11
Compression:
Stored size: 1.09 KB
Contents
module Admin class SnippetsController < BaseController sections 'settings' def index @snippets = current_site.snippets end def new @snippet = current_site.snippets.build end def edit @snippet = current_site.snippets.find(params[:id]) end def create @snippet = current_site.snippets.build(params[:snippet]) if @snippet.save flash_success! redirect_to edit_admin_snippet_url(@snippet) else flash_error! render :action => 'new' end end def update @snippet = current_site.snippets.find(params[:id]) if @snippet.update_attributes(params[:snippet]) flash_success! redirect_to edit_admin_snippet_url(@snippet) else flash_error! render :action => "edit" end end def destroy @snippet = current_site.snippets.find(params[:id]) begin @snippet.destroy flash_success! rescue Exception => e flash[:error] = e.to_s end redirect_to admin_snippets_url end end end
Version data entries
11 entries across 11 versions & 1 rubygems