0
私はモデルopening_timesとの関係でモデルの場所を持っています。私places_controllerでRails - フォーマットAPI応答の時間
私はこれを持っている:DB内
def index
places = Place.all
if places
render json: {
status: :ok,
result: places.as_json(
only: [
:id,
:name,
],
include: [
{ opening_times: {only: [:dayWeek, :open, :close]}},
]
)
}
else
render json: { errors: 'invalid request' }, status: 422
end
end
private
def place_params
params.require(:place).permit(:user_id, :name)
end
開閉列がtime
をしています。
フォーマット時間を%H:%M
として返すように強制するにはどうすればよいですか?
をごplaces_controller – num8er
の全体を追加してください@ num8er私は更新しました... – SaroVin