blob: c1c8a72cca0968c81ea77990596bb0ede3d9095c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
class RaftsController < ApplicationController
before_action :set_raft, only: %i[ edit update ]
before_action :set_crop, only: %i[ edit update ]
def edit
end
def update
if @raft.update(raft_params)
redirect_to beds_path, notice: "Raft #{@raft.id} successfully updated."
else
render :edit, status: :unprocessable_entity
end
end
private
def set_raft
@raft = Raft.find(params[:id])
end
def set_crop
@crops = Crop.order(:name)
end
def raft_params
params.require(:raft).permit(:location, :bed_id, :crop_id)
end
end
|