aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/company.rb
blob: 9d5737a6ca189e06e2c919703c71a03e678de7d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Chouette
  class Company < Chouette::ActiveRecord
    has_metadata

    include CompanyRestrictions
    include LineReferentialSupport
    include ObjectidSupport
    include CustomFieldsSupport

    has_many :lines

    # validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}, :allow_nil => true, :allow_blank => true
    validates_presence_of :name
    validates_format_of :url, :with => %r{\Ahttps?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\Z}, :allow_nil => true, :allow_blank => true

    def self.nullable_attributes
      [:organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :url, :time_zone]
    end

  end
end