modelo_minuta
Last change
on this file since 101698b was
1b91e02,
checked in by aosorio <aosorio@…>, 8 years ago
|
Version para desarrollo local
|
-
Property mode set to
100755
|
File size:
619 bytes
|
Line | |
---|
1 | class ParticipationsController < ApplicationController |
---|
2 | before_action :authenticate_user! |
---|
3 | |
---|
4 | def create |
---|
5 | post = current_user.find_visible_shareable_by_id(Post, params[:post_id]) |
---|
6 | if post |
---|
7 | current_user.participate! post |
---|
8 | render nothing: true, status: :created |
---|
9 | else |
---|
10 | render nothing: true, status: :forbidden |
---|
11 | end |
---|
12 | end |
---|
13 | |
---|
14 | def destroy |
---|
15 | participation = current_user.participations.find_by target_id: params[:post_id] |
---|
16 | if participation |
---|
17 | participation.destroy |
---|
18 | render nothing: true, status: :ok |
---|
19 | else |
---|
20 | render nothing: true, status: :unprocessable_entity |
---|
21 | end |
---|
22 | end |
---|
23 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.