class DocumentCategory < ActiveRecord::Base
  attr_accessible :name, :information_standard_id, :institution_id, :priority

  # Associations
  belongs_to :institution
  belongs_to :information_standard
  has_many :documents, dependent: :destroy

  # Validations
  validates :institution_id, :information_standard_id, :name, presence: true

  # Will paginate uses this method
  # to know how many rows to show
  #

  #scope :order_institution_and_priority => order("kind DESC")}    

  def self.per_page
    50
  end

=begin
  # Associate related documents to
  # the same information_standard
  # before save
  #
  before_save :associate_documents_to_my_information_standard
  #
  def associate_documents_to_my_information_standard
    documents.update_all(information_standard_id: information_standard_id)
  end
=end

end
