21 lines
372 B
Ruby
21 lines
372 B
Ruby
class DayLogsController < ApplicationController
|
|
def new
|
|
@day_log = DayLog.new
|
|
end
|
|
|
|
def create
|
|
@day_log = Current.user.day_logs.build(day_log_params)
|
|
|
|
if @day_log.save
|
|
redirect_to root_path
|
|
else
|
|
render :new, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def day_log_params
|
|
params.expect(day_log: [ :day, :info ])
|
|
end
|
|
end
|