Cheap way to limit control to owned alerts
This commit is contained in:
parent
0489c51518
commit
f463c66eff
1 changed files with 4 additions and 4 deletions
|
@ -13,7 +13,7 @@ class AlertsController < ApplicationController
|
||||||
# GET /alerts/1
|
# GET /alerts/1
|
||||||
# GET /alerts/1.json
|
# GET /alerts/1.json
|
||||||
def show
|
def show
|
||||||
@alert = Alert.find(params[:id])
|
@alert = Alert.user_alerts(current_user.id).find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # show.html.erb
|
format.html # show.html.erb
|
||||||
|
@ -33,7 +33,7 @@ class AlertsController < ApplicationController
|
||||||
|
|
||||||
# GET /alerts/1/edit
|
# GET /alerts/1/edit
|
||||||
def edit
|
def edit
|
||||||
@alert = Alert.find(params[:id])
|
@alert = Alert.user_alerts(current_user.id).find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /alerts
|
# POST /alerts
|
||||||
|
@ -53,7 +53,7 @@ class AlertsController < ApplicationController
|
||||||
# PUT /alerts/1
|
# PUT /alerts/1
|
||||||
# PUT /alerts/1.json
|
# PUT /alerts/1.json
|
||||||
def update
|
def update
|
||||||
@alert = Alert.find(params[:id])
|
@alert = Alert.user_alerts(current_user.id).find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @alert.update_attributes(params[:alert])
|
if @alert.update_attributes(params[:alert])
|
||||||
|
@ -67,7 +67,7 @@ class AlertsController < ApplicationController
|
||||||
# DELETE /alerts/1
|
# DELETE /alerts/1
|
||||||
# DELETE /alerts/1.json
|
# DELETE /alerts/1.json
|
||||||
def destroy
|
def destroy
|
||||||
@alert = Alert.find(params[:id])
|
@alert = Alert.user_alerts(current_user.id).find(params[:id])
|
||||||
@alert.destroy
|
@alert.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
Loading…
Reference in a new issue