Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CheckoutsController < ApplicationController
- ...
- def create
- @checkout = @item.checkouts.build(checkout_params)
- respond_to do |format|
- if @checkout.save
- if @checkout.reservation == true
- @checkout.create_activity :reservation, options = { owner: Person.find(@checkout.checked_out_by), recipient: @item, approved_by_id: @user.id }
- else
- @checkout.create_activity :create, options = { owner: Person.find(@checkout.checked_out_by), recipient: @item, approved_by_id: @user.id }
- end
- format.html { redirect_to checkouts_path, notice: 'Checkout was successfully created.' }
- format.json { render json: @checkout, status: :created, location: @checkout }
- else
- format.html { render :new }
- format.json { render json: @checkout.errors, status: :unprocessable_entity }
- end
- end
- ...
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement