Sha256: 2a9dc63516c307bfb6fd6fe40faa6c884afe8cf5acdc8f248f5567fb317263ef

Contents?: true

Size: 1.57 KB

Versions: 8

Compression:

Stored size: 1.57 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
#

# == 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)
#
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 < 0"
  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

8 entries across 8 versions & 1 rubygems

Version Path
muck-services-0.1.23 app/models/oai_endpoint.rb
muck-services-0.1.22 app/models/oai_endpoint.rb
muck-services-0.1.21 app/models/oai_endpoint.rb
muck-services-0.1.20 app/models/oai_endpoint.rb
muck-services-0.1.19 app/models/oai_endpoint.rb
muck-services-0.1.18 app/models/oai_endpoint.rb
muck-services-0.1.17 app/models/oai_endpoint.rb
muck-services-0.1.16 app/models/oai_endpoint.rb