出于某种原因,当我尝试添加记录时,此方法出现错误。具体错误是参数数量错误(3 代表 2)
def addrecord
res=MultiGeocoder.geocode(params[:street], params[:city], params[:state])
lat, lng = res.ll.split(",")
Bathroom.create(:name =>params[:name],
:bathroomtype =>params[:bathroomtype],
:street =>params[:street],
:city =>params[:city],
:state =>params[:state],
:country =>params[:country],
:postal =>params[:postal],
:lat => lat,
:lon => lng,
:access =>params[:access],
:directions =>params[:directions],
:comment =>params[:comment],
:created => Time.now,
:source => 'Squat',
:avail =>params[:avail] )
respond_to do |format|
format.json { render :nothing => true }
end
end
This is an example call...
> http:..../bathrooms/addrecord?name=Apple%20Store&bathroomtype=1&street=One%20Stockton%20St.&city=San%20Francisco&state=CA&country=United%20States&postal=94108&access=0&directions=&comment=&avail=0
这是请求参数:
要求
参数:
{"city"=>"San Francisco",
"avail"=>"0",
"access"=>"0",
"bathroomtype"=>"1",
"comment"=>"",
"country"=>"United States",
"directions"=>"",
"name"=>"Apple Store",
"street"=>"One Stockton St.",
"postal"=>"94108",
"state"=>"CA"}
我错过了什么?
任何帮助表示赞赏。