Sha256: e7f8d826bba169af281c482d21dbdf0c62d85c1a7de691c325ddf09b73909ddb

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

module Gemgento

  # @author Gemgento LLC
  class Country < ActiveRecord::Base
    has_many :regions

    default_scope -> { order :name }

    # JSON representation of the Country.
    #
    # @param options [Hash]
    # @return [Hash]
    def as_json(options = nil)
      result = super
      result[:regions] = self.regions if self.regions.loaded?

      return result
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 app/models/gemgento/country.rb