Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 运行CURL命令创建新位置后,获得422个不可处理的实体_Ruby On Rails_Ruby On Rails 4_Curl - Fatal编程技术网

Ruby on rails 运行CURL命令创建新位置后,获得422个不可处理的实体

Ruby on rails 运行CURL命令创建新位置后,获得422个不可处理的实体,ruby-on-rails,ruby-on-rails-4,curl,Ruby On Rails,Ruby On Rails 4,Curl,我有一个小问题,那就是我的“创建新地方”计划没有通过 这是我的curl命令: curl -H 'Content-Type: application/json' -X POST -d '{"place": {"name": "the stroke", "address": "the stroke YOLO", "description":"YOLOOOOO", "phone":"9128911", "website":"www.thestrokes.com"}}' http://localhost

我有一个小问题,那就是我的“创建新地方”计划没有通过

这是我的curl命令:

curl -H 'Content-Type: application/json' -X POST -d '{"place": {"name": "the stroke", "address": "the stroke YOLO", "description":"YOLOOOOO", "phone":"9128911", "website":"www.thestrokes.com"}}' http://localhost:3000/api/v1/places
-i -H 'Authorization: Token token="8f8315d4892044479450ef3403c0af95"'
这是我的地方:

 module Api 
    module V1
        class PlacesController < Api::ApiController  # Api::BaseController
            respond_to :json
         before_action :authenticate #This authenticate method inherit from Api Controller
         skip_before_action :verify_authenticity_token


         def index
            respond_with @user.places
         end

         def show
            respond_with Place.find(params[:id])
         end

         def create
            respond_with Place.create(params[:product])
         end

         def update
            respond_with Place.update(params[:id], params[:products])
         end

         def destroy
            respond_with Place.destroy(params[:id])
         end

            # private

            # def authenticate
            #   authenticate_or_request_with_http_token do |token, options|
            #   current_user.find_by(access_token: token)
            # end

            # end
        end
    end
end
希望有人能帮我解决这个问题

Started POST "/api/v1/places" for ::1 at 2015-07-31 17:07:10 +0800
Processing by Api::V1::PlacesController#create as JSON
  Parameters: {"place"=>{"name"=>"the stroke", "address"=>"the stroke YOLO", "description"=>"YOLOOOOO", "phone"=>"9128911", "website"=>"www.thestrokes.com"}}
  User Load (0.1ms)  SELECT  "users".* FROM "users" WHERE "users"."access_token" = ? LIMIT 1  [["access_token", "8f8315d4892044479450ef3403c0af95"]]
   (0.1ms)  begin transaction
   (0.1ms)  rollback transaction
Completed 422 Unprocessable Entity in 6ms (Views: 0.2ms | ActiveRecord: 0.3ms)