<commit_before>module DanvanthiriCore
  class AmbulanceService < ActiveRecord::Base
    include CustomValidation
    mount_uploader :logo, ImageUploader

    has_many :likes, as: :likeable, dependent: :destroy
    has_many :ratings, as: :rateable, dependent: :destroy
    has_many :ambulance_services_categories, foreign_key: "ambulance_service_id", dependent: :destroy
    has_many :ambulance_categories, through: :ambulance_services_categories

    validates :name, :area, presence: true
    validates :mobile, presence: true
    validates :mobile, length: { is: 10 }, allow_blank: true

    def update_rating!
      update_column :rate, ratings.average(:rate)
    end
  end
end<commit_msg>ambulance service validation<commit_after>module DanvanthiriCore
  class AmbulanceService < ActiveRecord::Base
    include CustomValidation
    mount_uploader :logo, ImageUploader
    mount_uploader :banner, ImageUploader

    has_many :likes, as: :likeable, dependent: :destroy
    has_many :ratings, as: :rateable, dependent: :destroy
    has_many :ambulance_services_categories, foreign_key: "ambulance_service_id", dependent: :destroy
    has_many :ambulance_categories, through: :ambulance_services_categories

    validates :name, :area, presence: true
    validates :mobile_number, uniqueness: true, allow_blank: true
    #validates :mobile, length: { is: 10 }, allow_blank: true

    def update_rating!
      update_column :rate, ratings.average(:rate)
    end
  end
end
{'fraction_non_alphanumeric': 0.08095238095238096, 'fraction_numerical': 0.0027210884353741495, 'mean_word_length': 5.028688524590164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1684110', 'n_tokens_mistral': 450, 'n_tokens_neox': 425, 'n_words': 118}