Class: Woa::SnippetsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Woa::SnippetsController
- Defined in:
- app/controllers/woa/snippets_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/woa/snippets_controller.rb', line 15 def create @snippet = HelperSnippet.new(params[:helper_snippet]) respond_to do |format| if @snippet.save format.html { redirect_to(woa_snippets_url, :notice => 'Snippet was successfully created.') } format.xml { render :xml => @snippet, :status => :created } else format.html { render :action => "new" } format.xml { render :xml => @snippet.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/woa/snippets_controller.rb', line 47 def destroy @snippet = Division.find(params[:id]) @snippet.destroy respond_to do |format| format.html { redirect_to(woa_snippets_url) } format.xml { head :ok } end end |
#edit ⇒ Object
29 30 31 |
# File 'app/controllers/woa/snippets_controller.rb', line 29 def edit @snippet = HelperSnippet.find(params[:id]) end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/woa/snippets_controller.rb', line 7 def index @snippets = HelperSnippet.all end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/woa/snippets_controller.rb', line 11 def new @snippet = HelperSnippet.new end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/woa/snippets_controller.rb', line 33 def update @snippet = HelperSnippet.find(params[:id]) respond_to do |format| if @snippet.update_attributes(params[:helper_snippet]) format.html { redirect_to(woa_snippets_url, :notice => 'Snippet was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @snippet.errors, :status => :unprocessable_entity } end end end |