Class: Woa::SnippetsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/woa/snippets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

#destroyObject



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

#editObject



29
30
31
# File 'app/controllers/woa/snippets_controller.rb', line 29

def edit
  @snippet = HelperSnippet.find(params[:id])
end

#indexObject



7
8
9
# File 'app/controllers/woa/snippets_controller.rb', line 7

def index
  @snippets = HelperSnippet.all
end

#newObject



11
12
13
# File 'app/controllers/woa/snippets_controller.rb', line 11

def new
  @snippet = HelperSnippet.new
end

#updateObject



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