Sha256: f2ecccc4af530d2511e09043786325caf60e859706e7eb5db417bb04e0efc573

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

class VirtualDomain < ActiveRecord::Base

  has_many :virtual_users
  has_many :virtual_aliases
  has_and_belongs_to_many :admin_users, :join_table => :users_domains

  attr_accessible :name

  validates :name,
    :presence   => true, :uniqueness => true,
    :format     => { :with => /\A(?:[-a-z0-9]+\.)+[a-z]{2,}\Z/i }

  default_scope order('id DESC').includes([:virtual_users, :virtual_aliases])

  def as_json(opt={})
    super opt.merge({
            :include => [:virtual_users, :virtual_aliases]
         })
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rmails-0.2.5 app/models/virtual_domain.rb
rmails-0.2.4 app/models/virtual_domain.rb
rmails-0.2.3 app/models/virtual_domain.rb