membership gremium scope

This commit is contained in:
Andreas Stephanides
2014-09-14 18:30:56 +02:00
parent f8d00e7b4f
commit c40804b5cb
3 changed files with 7 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ class Membership < ActiveRecord::Base
belongs_to :fetprofile
belongs_to :gremium
scope :active, -> {where("stop >= ? OR stop IS NULL", Time.now.to_date)}
scope :visible_in_gremium, ->{active.includes(:fetprofile).order(:typ,"fetprofiles.vorname","fetprofiles.nachname")}
validates :typ, :presence=>true
validates :fetprofile, :presence=>true
validates :start, :presence=>true