Sha256: 5984ac5d96aad67a89f549f9aa68649761ee48ab1a3da4b93bba168758c7ad51

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

# == Schema Information
#
# Table name: country_phones
#
#  id         :integer          not null, primary key
#  title      :string(255)
#  value      :string(255)
#  sort_order :integer          default(1)
#  created_at :datetime
#  updated_at :datetime
#

class CountryPhone < ActiveRecord::Base
  validates :title, :value, presence: true

  default_scope -> { order("#{quoted_table_name}.sort_order") }

  class << self
    def localized_first
      all.partition { |p| p.default_locale && (p.default_locale.to_sym == I18n.locale) }.flatten
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/models/country_phone.rb