tab/app/models/notification.rb

22 lines
463 B
Ruby
Raw Normal View History

2017-01-09 16:41:24 +01:00
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# user_id :integer not null
# message :string
# read :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
#
2017-01-09 16:22:58 +01:00
class Notification < ActiveRecord::Base
belongs_to :user
2017-01-14 16:22:44 +01:00
scope :unread, -> { where read: false }
2017-01-09 16:22:58 +01:00
def read!
update_attributes read: true
end
end