Sha256: baadecd75d9221a45255bc64bbbdebd0ae88fbc979c60757a46c3a0eb82d1478

Contents?: true

Size: 1.33 KB

Versions: 24

Compression:

Stored size: 1.33 KB

Contents

# == Schema Information
#
# Table name: oai_endpoints
#
#  id                  :integer(4)      not null, primary key
#  uri                 :string(2083)
#  display_uri         :string(2083)
#  metadata_prefix     :string(255)
#  title               :string(1000)
#  short_title         :string(100)
#  contributor_id      :integer(4)
#  status              :integer(4)
#  default_language_id :integer(4)
#  created_at          :datetime
#  updated_at          :datetime
#
class OaiEndpoint < ActiveRecord::Base
  
  belongs_to :contributor, :class_name => 'User', :foreign_key => 'contributor_id'
  belongs_to :default_language, :class_name => 'Language', :foreign_key => 'default_language_id'
  
  validates_presence_of :uri
  
  named_scope :banned, :conditions => ["status = ?", MuckServices::Status::BANNED]
  named_scope :valid, :conditions => "status >= 0"
  named_scope :by_title, :order => "title ASC"
  named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
  named_scope :by_newest, :order => "created_at DESC", :include => [:default_language]
  
  attr_protected :status, :contributor_id
  
  def banned?
    self.status == MuckServices::Status::BANNED
  end

  def pending?
    self.status == MuckServices::Status::PENDING
  end

  def inform_admin
    ServicesMailer.deliver_notification_feed_added(self)
  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
muck-services-0.1.47 app/models/oai_endpoint.rb
muck-services-0.1.46 app/models/oai_endpoint.rb
muck-services-0.1.45 app/models/oai_endpoint.rb
muck-services-0.1.44 app/models/oai_endpoint.rb
muck-services-0.1.43 app/models/oai_endpoint.rb
muck-services-0.1.42 app/models/oai_endpoint.rb
muck-services-0.1.41 app/models/oai_endpoint.rb
muck-services-0.1.40 app/models/oai_endpoint.rb
muck-services-0.1.39 app/models/oai_endpoint.rb
muck-services-0.1.38 app/models/oai_endpoint.rb
muck-services-0.1.37 app/models/oai_endpoint.rb
muck-services-0.1.36 app/models/oai_endpoint.rb
muck-services-0.1.35 app/models/oai_endpoint.rb
muck-services-0.1.34 app/models/oai_endpoint.rb
muck-services-0.1.33 app/models/oai_endpoint.rb
muck-services-0.1.32 app/models/oai_endpoint.rb
muck-services-0.1.31 app/models/oai_endpoint.rb
muck-services-0.1.30 app/models/oai_endpoint.rb
muck-services-0.1.29 app/models/oai_endpoint.rb
muck-services-0.1.28 app/models/oai_endpoint.rb