For some reason I am getting an error on this method when I am trying to add a record.
The specific error is
wrong number of arguments (3 for 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
This is the request parms:
Request
Parameters:
{"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"}
What am I missing?
Any help appreciated.
You have to give a location as the first parameter here, and options as the rest:
Try to send it as a string, like this: