@lgn21st 我是搞驱动的。准备学习 rails。咋不能发贴?
@lgn21st , status: :unprocessable_entity ---- 最新 RAILS 代码 :status => :unprocessable_entity 这两个功能一样吗?
# POST /posts # POST /posts.json def create @post = Post.new(params[:post])
respond_to do |format| if @post.save format.html { redirect_to @post, notice: 'Post was successfully created.' } format.json { render json: @post, status: :created, location: @post } else format.html { render action: "new" } format.json { render json: @post.errors, status: :unprocessable_entity } end end end status: :unprocessable_entity 这是什么语法?