Sha256: 531f7f0234a72146931c8a20747d074d9a3409f158e705969192e0903f4ad1d6

Contents?: true

Size: 433 Bytes

Versions: 18

Compression:

Stored size: 433 Bytes

Contents

module Admin
  class State < ActiveRecord::Base
    include Carnival::ModelHelper
    self.table_name = "states"

    belongs_to :country
    has_many :cities

    validates_presence_of :name
    validates_presence_of :code
    validates_uniqueness_of :code

    scope :national, -> {includes(:country).where("countries.code = ?", "BR")}
    scope :international, -> {includes(:country).where("countries.code <> ?", "BR")}
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
carnival-0.0.55 test/dummy/app/models/admin/state.rb
carnival-0.0.54 test/dummy/app/models/admin/state.rb
carnival-0.0.53 test/dummy/app/models/admin/state.rb
carnival-0.0.52 test/dummy/app/models/admin/state.rb
carnival-0.0.51 test/dummy/app/models/admin/state.rb
carnival-0.0.50 test/dummy/app/models/admin/state.rb
carnival-0.0.49 test/dummy/app/models/admin/state.rb
carnival-0.0.48 test/dummy/app/models/admin/state.rb
carnival-0.0.47 test/dummy/app/models/admin/state.rb
carnival-0.0.45 test/dummy/app/models/admin/state.rb
carnival-0.0.44 test/dummy/app/models/admin/state.rb
carnival-0.0.43 test/dummy/app/models/admin/state.rb
carnival-0.0.42 test/dummy/app/models/admin/state.rb
carnival-0.0.41 test/dummy/app/models/admin/state.rb
carnival-0.0.40 test/dummy/app/models/admin/state.rb
carnival-0.0.39 test/dummy/app/models/admin/state.rb
carnival-0.0.38 test/dummy/app/models/admin/state.rb
carnival-0.0.37 test/dummy/app/models/admin/state.rb