포도와 함께 할 수있는 방법이 있습니까 & 데이터를 엔티티로 자동 직렬화하려면 Grape-Entity가 필요합니까? [: VAR (에서 : https://github.com/intridea/grape) 모든 예제는 PARAMS 사용하는 것 같다 게시/게시시 포도 엔티티로 직렬화
desc "Create a status."
params do
requires :status, type: String, desc: "Your status."
end
post do
authenticate!
Status.create!({
user: current_user,
text: params[:status]
})
end
게시 된 개체는 더 복잡하다
은 (새로운 사람 (이름, 성, 주소 등)를 말할 수를 있나요 ??? 방법이 자동으로이 같은 사용의 어떤 종류를 찾고 API가 나타내는 엔티티로 변신 가지고 : 그렇다면, 어쩌면MyModel.new(params)
또는 더 나은
이
post do
authenticate!
entity.first_name
entity.last_name
end
결과적으로 허용 된 매개 변수에 대해 엔티티의 유일한 속성을 만들 수 있습니까? – Prescott