Sha256: 3ae3ce7a5a73352a07da7303593c5f13deb36c13082c9e1d55a4d48cd45403e6
Contents?: true
Size: 842 Bytes
Versions: 2
Compression:
Stored size: 842 Bytes
Contents
module Adherent class Member < ActiveRecord::Base attr_accessible :birthdate, :forname, :name, :number pick_date_for :birthdate belongs_to :organism, class_name: 'Organism' has_one :coord has_many :adhesions has_many :payments validates :number, :name, :forname , :presence=>true validates_uniqueness_of :number, :scope=>:organism_id def unpaid_adhesions adhesions.reject {|adh| adh.is_paid? } end def unpaid_adhesions? unpaid_adhesions.any? end def unpaid_amount unpaid_adhesions.sum(&:due) end def to_s [forname, name.capitalize].join(' ') end def next_adhesion adh = adhesions(true).order('to_date').last n_ad = Adhesion.next_adh_values(adh) adhesions.new(n_ad) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adherent-0.1.1 | app/models/adherent/member.rb |
adherent-0.1.0 | app/models/adherent/member.rb |