module JamRuby
  class JamTrackLicensor < ActiveRecord::Base

    table_name = 'jam_track_licensors'

    attr_accessible :name, :description, :attention, :address_line_1, :address_line_2,
                    :city, :state, :zip_code, :contact, :email, :phone, :slug, as: :admin

    validates :name,            presence: true, uniqueness: true, length: {maximum: 200}
    validates :description,     length: {maximum: 1000}
    validates :attention,       length: {maximum: 200}
    validates :address_line_1,  length: {maximum: 200}
    validates :address_line_2,  length: {maximum: 200}
    validates :city,            length: {maximum: 200}
    validates :state,           length: {maximum: 200}
    validates :zip_code,        length: {maximum: 200}
    validates :contact,         length: {maximum: 200}
    validates :email,           length: {maximum: 200}
    validates :phone,           length: {maximum: 200}

    has_many :jam_tracks, :class_name => "JamRuby::JamTrack", foreign_key: 'licensor_id', :inverse_of => :licensor
  end
end
