0
Failures:
1) POST /v1/notes/id saves the lat, lon, note text, note photo, recipients, and expiration
Failure/Error: post '/v1/notes', {
ActiveRecord::StatementInvalid:
PG::DatatypeMismatch: ERROR: argument of WHERE must be type boolean, not type integer
LINE 1: SELECT "users".* FROM "users" WHERE (45) LIMIT 1
^
: SELECT "users".* FROM "users" WHERE (45) LIMIT 1
나는 다음과 같은 방법으로 사용자 개체를 찾아야 만한다고 가정하지만, 어떤 이유로 위의 오류가 나타납니다.PG 오류 - 데이터 불일치
def create
@note = Note.new(note_params)
if @note.save
render
end
end
private
def note_params
{
#user_id: params[:user_id],
user_id: user[:id],
lat: params[:lat],
lon: params[:lon],
note_text: params[:note_text],
photo_uri: params[:photo_uri],
expiration: params[:expiration]
}
end
def user
user = User.find_or_create_by(params[:user_id])
end
난 당신이 note_params
에 들어갈 것 user_id를 기반으로 사용자 개체를 만들거나 찾을 user
방법을 사용 싶어한다고 가정하지만, user_id: user[:id]
를 사용하는 대신 사이의 차이에 대한 명확한 아니에요 #user_id: params[:user_id]
.