class ConditionsController

This class processes the web-side portion of things.

Public Instance Methods

create() click to toggle source

POST /conditions POST /conditions.json

# File app/controllers/conditions_controller.rb, line 54
def create
  @condition = Condition.new(params[:condition])

  respond_to do |format|
    if @condition.save
      format.html { redirect_to @condition, :notice => 'Condition was successfully created.' }
      format.json { render :json => @condition, :status => :created, :location => @condition }
    else
      format.html { render :action => "new" }
      format.json { render :json => @condition.errors, :status => :unprocessable_entity }
    end
  end
end
destroy() click to toggle source

DELETE /conditions/1 DELETE /conditions/1.json

# File app/controllers/conditions_controller.rb, line 86
def destroy
  @condition = Condition.find(params[:id])
  @condition.destroy

  respond_to do |format|
    format.html { redirect_to conditions_url }
    format.json { head :ok }
  end
end
edit() click to toggle source

GET /conditions/1/edit

# File app/controllers/conditions_controller.rb, line 48
def edit
  @condition = Condition.find(params[:id])
end
index() click to toggle source

GET /conditions GET /conditions.json

# File app/controllers/conditions_controller.rb, line 16
def index
  @conditions = Condition.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render :json => @conditions }
  end
end
new() click to toggle source

GET /conditions/new GET /conditions/new.json

# File app/controllers/conditions_controller.rb, line 38
def new
  @condition = Condition.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render :json => @condition }
  end
end
show() click to toggle source

GET /conditions/1 GET /conditions/1.json

# File app/controllers/conditions_controller.rb, line 27
def show
  @condition = Condition.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @condition }
  end
end
update() click to toggle source

PUT /conditions/1 PUT /conditions/1.json

# File app/controllers/conditions_controller.rb, line 70
def update
  @condition = Condition.find(params[:id])

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