Sha256: 8eb941f694dda12290c1b47563dda48c5b62ddad96cb26e2a356dfeba8729989

Contents?: true

Size: 719 Bytes

Versions: 14

Compression:

Stored size: 719 Bytes

Contents

module SiteFramework
  # This model represent the **Site** entity.
  # [SiteFramework::Middleware] will check for a site
  # with current domain of request and attach the object
  # to global **Rails** object
  class Site < (defined?(ActiveRecord) ? ActiveRecord::Base : Object)

    if defined? Mongoid
      include Mongoid::Document
      include Mongoid::Timestamps

      field :title, :type => String
      field :description, :type => String

      embeds_many :domains
    end

    has_many :domains if defined? ActiveRecord::Base

    # This method returns a slug for site title
    def slug
      if title
        title
      else
        # TODO: generate a sha1 hash base on time
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
site_framework-4.3.3 app/models/site_framework/site.rb
site_framework-4.3.2 app/models/site_framework/site.rb
site_framework-4.3.1 app/models/site_framework/site.rb
site_framework-4.3.0 app/models/site_framework/site.rb
site_framework-4.2.0 app/models/site_framework/site.rb
site_framework-4.1.2 app/models/site_framework/site.rb
site_framework-4.1.0 app/models/site_framework/site.rb
site_framework-4.0.1 app/models/site_framework/site.rb
site_framework-4.0.0 app/models/site_framework/site.rb
site_framework-3.2.0 app/models/site_framework/site.rb
site_framework-3.1.0 app/models/site_framework/site.rb
site_framework-2.0.0 app/models/site_framework/site.rb
site_framework-1.0.2 app/models/site_framework/site.rb
site_framework-1.0.1 app/models/site_framework/site.rb