<commit_before>class Location < ActiveRecord::Base
  acts_as_paranoid
  belongs_to :organization  # Locations are organization locations
  belongs_to :country
  belongs_to :state
  validates_presence_of :name, :organization_id, :city, :country_id
  has_many :bikes

  scope :by_state, -> { order(:state_id) }
  scope :shown, -> { where(shown: true) }
  # scope :international, where("country_id IS NOT #{Country.united_states.id}")

  before_save :shown_from_organization
  def shown_from_organization
    self.shown = organization && organization.allowed_show
    true
  end

  def address
    return nil unless self.country
    a = []
    a << street
    a << city
    a << state.abbreviation if state.present?
    (a+[zipcode, country.name]).compact.join(', ')
  end

  unless Rails.env.test?
    geocoded_by :address<commit_msg>add touch to locations to block locations<commit_after>class Location < ActiveRecord::Base
  acts_as_paranoid
  belongs_to :organization, touch: true  # Locations are organization locations
  belongs_to :country
  belongs_to :state
  validates_presence_of :name, :organization_id, :city, :country_id
  has_many :bikes

  scope :by_state, -> { order(:state_id) }
  scope :shown, -> { where(shown: true) }
  # scope :international, where("country_id IS NOT #{Country.united_states.id}")

  before_save :shown_from_organization
  def shown_from_organization
    self.shown = organization && organization.allowed_show
    true
  end

  def address
    return nil unless self.country
    a = []
    a << street
    a << city
    a << state.abbreviation if state.present?
    (a+[zipcode, country.name]).compact.join(', ')
  end

  unless Rails.env.test?
    geocoded_by :address
{'fraction_non_alphanumeric': 0.10087976539589442, 'fraction_numerical': 0.0, 'mean_word_length': 4.002932551319648, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 7, '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': '4701272', 'n_tokens_mistral': 561, 'n_tokens_neox': 536, 'n_words': 137}