Sha256: d770204d71285a9fb23a91638733a41f6968f3bd8158a9b87fe33785851471db

Contents?: true

Size: 749 Bytes

Versions: 7

Compression:

Stored size: 749 Bytes

Contents

# == Schema Information
#
# Table name: got_fixed_issues
#
#  id         :integer          not null, primary key
#  title      :string(255)
#  closed     :boolean
#  created_at :datetime
#  updated_at :datetime
#  number     :integer
#  vendor_id  :string(255)
#  vendor     :string(255)
#

module GotFixed
  class Issue < ActiveRecord::Base
    default_scope { order("updated_at DESC") }
    validates_uniqueness_of :vendor_id, :scope => :vendor

    has_and_belongs_to_many :users

    after_update :send_notifications, :if => :just_closed?

    private

      def just_closed?
        !closed_was && closed
      end

      def send_notifications
        users.each do |user|
          user.send_notification self
        end
      end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
got_fixed-0.1.0 app/models/got_fixed/issue.rb
got_fixed-0.0.6 app/models/got_fixed/issue.rb
got_fixed-0.0.5 app/models/got_fixed/issue.rb
got_fixed-0.0.4 app/models/got_fixed/issue.rb
got_fixed-0.0.3 app/models/got_fixed/issue.rb
got_fixed-0.0.2 app/models/got_fixed/issue.rb
got_fixed-0.0.1 app/models/got_fixed/issue.rb