diff options
| author | mo khan <mo@mokhan.ca> | 2015-02-03 20:52:31 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-02-03 20:52:31 -0700 |
| commit | f73d0b92873a46d1fade3184c464b1bfe909fecb (patch) | |
| tree | 579f8c94504f809bb755bcb6fe2d415188385bfb /app/controllers/dispositions_controller.rb | |
| parent | fe7d2f8b8d806c65899c42d215cdd1578b3a108d (diff) | |
add scaffold for dispositions.
Diffstat (limited to 'app/controllers/dispositions_controller.rb')
| -rw-r--r-- | app/controllers/dispositions_controller.rb | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/app/controllers/dispositions_controller.rb b/app/controllers/dispositions_controller.rb new file mode 100644 index 0000000..2e5a1a3 --- /dev/null +++ b/app/controllers/dispositions_controller.rb @@ -0,0 +1,76 @@ +class DispositionsController < ApplicationController + before_action :set_disposition, only: [:show, :edit, :update, :destroy] + + # GET /dispositions + # GET /dispositions.json + def index + @dispositions = Disposition.all + end + + # GET /dispositions/1 + # GET /dispositions/1.json + def show + end + + # GET /dispositions/new + def new + @disposition = Disposition.new + @states = Disposition.states + end + + # GET /dispositions/1/edit + def edit + @states = Disposition.states + end + + # POST /dispositions + # POST /dispositions.json + def create + @disposition = Disposition.new(disposition_params) + + respond_to do |format| + if @disposition.save + format.html { redirect_to @disposition, notice: 'Disposition was successfully created.' } + format.json { render :show, status: :created, location: @disposition } + else + format.html { render :new } + format.json { render json: @disposition.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /dispositions/1 + # PATCH/PUT /dispositions/1.json + def update + respond_to do |format| + if @disposition.update(disposition_params) + format.html { redirect_to @disposition, notice: 'Disposition was successfully updated.' } + format.json { render :show, status: :ok, location: @disposition } + else + format.html { render :edit } + format.json { render json: @disposition.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /dispositions/1 + # DELETE /dispositions/1.json + def destroy + @disposition.destroy + respond_to do |format| + format.html { redirect_to dispositions_url, notice: 'Disposition was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_disposition + @disposition = Disposition.find_by(fingerprint: params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def disposition_params + params.require(:disposition).permit(:fingerprint, :state) + end +end |
