1
0
Fork 0

Fat model, skinny controller for selecting user_alerts

This commit is contained in:
Andrew Tomaka 2013-04-06 01:52:53 -04:00
parent dd5c725715
commit d0d9072294
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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