Skip to content

Instantly share code, notes, and snippets.

@tubbo
Created April 19, 2012 19:42
Show Gist options
  • Save tubbo/2423628 to your computer and use it in GitHub Desktop.
Save tubbo/2423628 to your computer and use it in GitHub Desktop.
# POST /calls
# POST /calls.json
def create
@call = Call.new(params[:call])
@call.user_id = current_user.id
respond_to do |format|
if @call.save
format.html { redirect_to @call, notice: 'Call was successfully created.' }
format.json { render json: @call, status: :created, location: @call }
else
format.html { render action: "new" }
format.json { render json: @call.errors, status: :unprocessable_entity }
end
end
end
# PUT /calls/1
# PUT /calls/1.json
def update
@call = Call.find(params[:id])
@call.user_id = current_user.id
respond_to do |format|
if @call.update_attributes(params[:call])
format.html { redirect_to @call, notice: 'Call was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @call.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment