Created
April 19, 2012 19:42
-
-
Save tubbo/2423628 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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