Sha256: fe30b6f2c7534657c23d087265fc457980692899b42c1071140e5f22706f7642

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

# == Schema Information
#
# Table name: default_areas
#
#  id              :integer          not null, primary key
#  organization_id :integer          not null
#  name            :string(255)      not null
#  created_at      :datetime
#  updated_at      :datetime
#

class DefaultArea < ActiveRecord::Base
  belongs_to :organization

  validates :name, presence: true, uniqueness: { scope: :organization_id },
    length: { maximum: 255 }
  validates :organization, presence: true

  def last_for_organization?
    organization.areas.where("default_areas.id != ?", id).count == 0
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_systeem-0.1.0 test/dummy_app/app/models/default_area.rb