Sha256: 0316285eaa70628a869cc8d9af4015472eabe58f130717ae8d9b9c4f4fa9c8cb

Contents?: true

Size: 550 Bytes

Versions: 4

Compression:

Stored size: 550 Bytes

Contents

class SimpleItem < Item
  # associations
  
  belongs_to :account
  
  # validations

  validates_presence_of :account

  def self.find_conflict(item)
    Item.all(:conditions => {
      :type => item.type,
      :date => item.date, 
      :account_id => item.account_id,
      :category_id => item.category_id,
      :position => item.position,
    }).reject{|x| x.id == item.id}.first
  end
  
  # featues

  acts_as_list :scope => [
    'date = #{date}',
    'account_id = #{account_id}',
    'category_id = #{category_id}',
  ].join(" AND ")
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
yhara-moneyrail-0.0.2 app/models/simple_item.rb
moneyrail-0.1.1 app/models/simple_item.rb
moneyrail-0.1.0 app/models/simple_item.rb
moneyrail-0.0.2 app/models/simple_item.rb