備忘録
boards_controller.rb
def create
byebug
@board = current_user.boards.build(board_params)
if @board.save
redirect_to boards_path, success: t('defaults.message.created', item: Board.model_name.human)
else
flash.now['danger'] = t('defaults.message.not_created', item: Board.model_name.human)
render :new
end
end
11: @board = Board.new
12: end
13:
14: def create
15: byebug
=> 16: @board = current_user.boards.build(board_params)
17: if @board.save
18: redirect_to boards_path, success: t('defaults.message.created', item: Board.model_name.human)
19: else
20: flash.now['danger'] = t('defaults.message.not_created', item: Board.model_name.human)
(byebug) board_params
<ActionController::Parameters {"title"=>"aaaaa", "body"=>"bbbbb", "board_image_cache"=>""} permitted: true>
デバッグ勉強中