Sha256: 4082e4816bf3913e73a0207f90702c581fa3731d8f5eb6c6fc85ab70a793b2f1

Contents?: true

Size: 1 KB

Versions: 27

Compression:

Stored size: 1 KB

Contents

class Country < ActiveRecord::Base
  include MasterModel
  default_scope :order => "position"
  has_many :patrons
  #has_many :people
  #has_many :corporate_bodies
  #has_many :families
  has_many :libraries
  has_one :library_group

  # If you wish to change the field names for brevity, feel free to enable/modify these.
  # alias_attribute :iso, :alpha_2
  # alias_attribute :iso3, :alpha_3
  # alias_attribute :numeric, :numeric_3

  # Validations
  validates_presence_of :alpha_2, :alpha_3, :numeric_3

  after_save :clear_all_cache
  after_destroy :clear_all_cache

  def self.all_cache
    Rails.cache.fetch('country_all'){Country.all}
  end

  def clear_all_cache
    Rails.cache.delete('country_all')
  end
end

# == Schema Information
#
# Table name: countries
#
#  id           :integer         not null, primary key
#  name         :string(255)     not null
#  display_name :text
#  alpha_2      :string(255)
#  alpha_3      :string(255)
#  numeric_3    :string(255)
#  note         :text
#  position     :integer
#

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
enju_event-0.0.24 spec/dummy/app/models/country.rb
enju_event-0.0.23 spec/dummy/app/models/country.rb
enju_event-0.1.10 spec/dummy/app/models/country.rb
enju_event-0.1.9 spec/dummy/app/models/country.rb
enju_event-0.0.22 spec/dummy/app/models/country.rb
enju_event-0.0.21 spec/dummy/app/models/country.rb
enju_event-0.1.8 spec/dummy/app/models/country.rb
enju_event-0.0.20 spec/dummy/app/models/country.rb
enju_event-0.1.7 spec/dummy/app/models/country.rb
enju_event-0.0.19 spec/dummy/app/models/country.rb
enju_event-0.1.6 spec/dummy/app/models/country.rb
enju_event-0.0.18 spec/dummy/app/models/country.rb
enju_event-0.0.17 spec/dummy/app/models/country.rb
enju_event-0.1.5 spec/dummy/app/models/country.rb
enju_event-0.0.16 spec/dummy/app/models/country.rb
enju_event-0.1.4 spec/dummy/app/models/country.rb
enju_event-0.1.3 spec/dummy/app/models/country.rb
enju_event-0.0.15 spec/dummy/app/models/country.rb
enju_event-0.0.14 spec/dummy/app/models/country.rb
enju_event-0.0.13 spec/dummy/app/models/country.rb