Fat model, skinny controller for selecting user_alerts
This commit is contained in:
parent
dd5c725715
commit
d0d9072294
2 changed files with 5 additions and 1 deletions
|
@ -3,7 +3,7 @@ class AlertsController < ApplicationController
|
||||||
# GET /alerts
|
# GET /alerts
|
||||||
# GET /alerts.json
|
# GET /alerts.json
|
||||||
def index
|
def index
|
||||||
@alerts = Alert.where("user_id = #{current_user.id}")
|
@alerts = Alert.user_alerts(current_user.id)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
|
|
|
@ -34,4 +34,8 @@ class Alert < ActiveRecord::Base
|
||||||
def sections
|
def sections
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.user_alerts(user_id)
|
||||||
|
Alert.where("user_id = #{user_id}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue