Module: MultipleBoardsActions
Instance Method Summary
collapse
#clear_memoization, #strong_memoize, #strong_memoized?
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/concerns/multiple_boards_actions.rb', line 23
def create
board = Boards::CreateService.new(parent, current_user, board_params).execute
respond_to do |format|
format.json do
if board.persisted?
= { board_path: board_path(board) }
render json: serialize_as_json(board).merge()
else
render json: board.errors, status: :unprocessable_entity
end
end
end
end
|
#destroy ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/concerns/multiple_boards_actions.rb', line 53
def destroy
service = Boards::DestroyService.new(parent, current_user)
service.execute(board)
respond_to do |format|
format.json { head :ok }
format.html { redirect_to boards_path, status: :found }
end
end
|
#recent ⇒ Object
16
17
18
19
20
21
|
# File 'app/controllers/concerns/multiple_boards_actions.rb', line 16
def recent
recent_visits = ::Boards::VisitsFinder.new(parent, current_user).latest(4)
recent_boards = recent_visits.map(&:board)
render json: serialize_as_json(recent_boards)
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'app/controllers/concerns/multiple_boards_actions.rb', line 38
def update
service = Boards::UpdateService.new(parent, current_user, board_params)
respond_to do |format|
format.json do
if service.execute(board)
= { board_path: board_path(board) }
render json: serialize_as_json(board).merge()
else
render json: board.errors, status: :unprocessable_entity
end
end
end
end
|