class Business < ActiveRecord::Base

  has_many :comments, :as => :commentable, :order => "created_at DESC"

  belongs_to :user
  belongs_to :business_status
  has_many :vehicles
  has_many :buildings

  attr_accessible :business_name, :contact_name, :address1, :address2, :city, :state, :zip,
    :phone, :fax, :site_address, :line_of_business, :description, :years_in_business, :current_carrier,
    :any_claims_or_losses, :business_type, :number_of_employees, :number_of_owners, :payroll_for_employees,
    :annual_gross_receipts, :annual_gross_receipts, :liability_limit, :employee_benefit_coverage,
    :workers_compensation_limit, :coverage_in_other_state, :umbrella_coverage, :business_status_id,
    :user_id
  # we do not have :comment and :admin_only here since we transfer them to corresponding comments records
  # at updates or saves, thus, we do not want to save them
  validates_presence_of :business_name, :contact_name, :address1, :city, :state, :zip, :phone, :user_id

end