Class: PineappleStepsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /pineapple_steps POST /pineapple_steps.xml



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 49

def create
  @pineapple_step = PineappleStep.new(params[:pineapple_step])

  respond_to do |format|
    if @pineapple_step.save
      format.html { redirect_to(@pineapple_step, :notice => 'Pineapple step was successfully created.') }
      format.xml  { render :xml => @pineapple_step, :status => :created, :location => @pineapple_step }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @pineapple_step.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /pineapple_steps/1 DELETE /pineapple_steps/1.xml



81
82
83
84
85
86
87
88
89
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 81

def destroy
  @pineapple_step = PineappleStep.find(params[:id])
  @pineapple_step.destroy

  respond_to do |format|
    format.html { redirect_to(pineapple_steps_url) }
    format.xml  { head :ok }
  end
end

#editObject

GET /pineapple_steps/1/edit



43
44
45
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 43

def edit
  @pineapple_step = PineappleStep.find(params[:id])
end

#indexObject

GET /pineapple_steps GET /pineapple_steps.xml



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 4

def index
  @pineapple_steps = PineappleStep.all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @pineapple_steps }
    format.json{
      render :json => @pineapple_steps.to_json
    }
  end
end

#newObject

GET /pineapple_steps/new GET /pineapple_steps/new.xml



32
33
34
35
36
37
38
39
40
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 32

def new
  @pineapple_step = PineappleStep.new

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @pineapple_step }
    
  end
end

#showObject

GET /pineapple_steps/1 GET /pineapple_steps/1.xml



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 18

def show
  @pineapple_step = PineappleStep.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @pineapple_step }
    format.json{
      render :json => @pineapple_step.to_json
    }
  end
end

#updateObject

PUT /pineapple_steps/1 PUT /pineapple_steps/1.xml



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/generators/pineapple/templates/app/controllers/pineapple_steps_controller.rb', line 65

def update
  @pineapple_step = PineappleStep.find(params[:id])

  respond_to do |format|
    if @pineapple_step.update_attributes(params[:pineapple_step])
      format.html { redirect_to(@pineapple_step, :notice => 'Pineapple step was successfully updated.') }
      format.xml  { head :ok }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @pineapple_step.errors, :status => :unprocessable_entity }
    end
  end
end