Class: Admin::PageSnippetsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PageSnippetsController
- Defined in:
- app/controllers/admin/page_snippets_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/admin/page_snippets_controller.rb', line 24 def create @page_snippet = PageSnippet.new(params[:page_snippet]) respond_to do |format| if @page_snippet.save format.html { redirect_to(admin_page_snippets_url, :notice => 'Page snippet was successfully created.') } format.xml { render :xml => @page_snippet, :status => :created, :location => @page_snippet } else format.html { render :action => "new" } format.xml { render :xml => @page_snippet.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/admin/page_snippets_controller.rb', line 52 def destroy @page_snippet = PageSnippet.find(params[:id]) @page_snippet.destroy respond_to do |format| format.html { redirect_to(admin_page_snippets_url) } format.xml { head :ok } format.js end end |
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/admin/page_snippets_controller.rb', line 20 def edit @page_snippet = PageSnippet.find(params[:id]) end |
#index ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/controllers/admin/page_snippets_controller.rb', line 2 def index @page_snippets = PageSnippet.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @page_snippets } end end |
#new ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/controllers/admin/page_snippets_controller.rb', line 11 def new @page_snippet = PageSnippet.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @page_snippet } end end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/admin/page_snippets_controller.rb', line 38 def update @page_snippet = PageSnippet.find(params[:id]) respond_to do |format| if @page_snippet.update_attributes(params[:page_snippet]) format.html { redirect_to(admin_page_snippets_url, :notice => 'Page snippet was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @page_snippet.errors, :status => :unprocessable_entity } end end end |