Sha256: c1fbd667fb782daf84f9c340744e85a7097ef935126a86c9968b6658bffb77dd

Contents?: true

Size: 499 Bytes

Versions: 30

Compression:

Stored size: 499 Bytes

Contents

class Membership < ActiveRecord::Base

  belongs_to :group
  belongs_to :reader
  
  named_scope :for, lambda { |reader|
    { :conditions => ["memberships.reader_id = ?", reader.id] }
  }

  named_scope :of, lambda { |group|
    { :conditions => ["memberships.group_id = ?", group.id] }
  }

  named_scope :by_reader_name, lambda {
    { 
      :joins => "INNER JOIN readers on memberships.reader_id = readers.id", 
      :group => "readers.id",
      :order => "readers.name ASC"
    }
  }
  
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.38 app/models/membership.rb
radiant-reader-extension-3.0.37 app/models/membership.rb
radiant-reader-extension-3.0.36 app/models/membership.rb
radiant-reader-extension-3.0.35 app/models/membership.rb
radiant-reader-extension-3.0.33 app/models/membership.rb
radiant-reader-extension-3.0.32 app/models/membership.rb
radiant-reader-extension-3.0.31 app/models/membership.rb
radiant-reader-extension-3.0.30 app/models/membership.rb
radiant-reader-extension-3.0.29 app/models/membership.rb
radiant-reader-extension-3.0.28 app/models/membership.rb
radiant-reader-extension-3.0.27 app/models/membership.rb
radiant-reader-extension-3.0.26 app/models/membership.rb
radiant-reader-extension-3.0.25 app/models/membership.rb
radiant-reader-extension-3.0.24 app/models/membership.rb
radiant-reader-extension-3.0.23 app/models/membership.rb
radiant-reader-extension-3.0.20 app/models/membership.rb
radiant-reader-extension-3.0.19 app/models/membership.rb
radiant-reader-extension-3.0.18 app/models/membership.rb
radiant-reader-extension-3.0.17 app/models/membership.rb
radiant-reader-extension-3.0.16 app/models/membership.rb