Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add back update method

  • Loading branch information...
commit 61f0516c1e27dc80e3ec20b1d077b256ffc6c14c 1 parent 7334320
@shawndrost shawndrost authored
Showing with 38 additions and 5 deletions.
  1. +7 −5 app/controllers/users_controller.rb
  2. +31 −0 db/schema.rb
View
12 app/controllers/users_controller.rb
@@ -11,11 +11,6 @@ def show
respond_with @user
end
- def new
- @user = User.new
- respond_with @user
- end
-
def create
@user = User.new(params[:user])
@user.save ?
@@ -23,6 +18,13 @@ def create
render(json: @user.errors, status: :unprocessable_entity)
end
+ def update
+ @user = User.find(params[:id])
+ @user.update_attributes(params[:user]) ?
+ head(:no_content) :
+ render(json: @user.errors, status: :unprocessable_entity)
+ end
+
def destroy
@user = User.find(params[:id])
@user.destroy
View
31 db/schema.rb
@@ -0,0 +1,31 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20120407234132) do
+
+ create_table "users", :force => true do |t|
+ t.string "email"
+ t.string "phone"
+ t.string "name"
+ t.string "facebook_uid"
+ t.string "twitter_uid"
+ t.date "birthday"
+ t.text "why_english"
+ t.text "source"
+ t.string "level"
+ t.string "max_price"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.