class ProviderLicense < ActiveRecord::Base
belongs_to :provider
+ belongs_to :license, :foreign_key => :demanders_license_id
validates :provider_id, :presence => true, :numericality => true, :existence => true
validates :providers_license_id, :presence => true, :numericality => true
validates :demanders_license_id, :presence => true, :numericality => true
+ def self.get_one pid, plid
+ ProviderLicense.find_by_provider_id_and_providers_license_id(pid, plid) || ProviderLicense.new
+ end
+
def self.exist_license pid, plid
ProviderLicense.find_by_provider_id_and_providers_license_id(pid, plid) != nil
end
end
raise ActiveRecord::Rollback if res.any?
end
- res
+ LicenseImportResult.new res
end
end