Sha256: 233b028580039e43e698bf444fc6862c11fcb938017b3e9d7054da04db5e3ea9

Contents?: true

Size: 405 Bytes

Versions: 5

Compression:

Stored size: 405 Bytes

Contents

module G5Updatable::BelongsToLocation
  extend ActiveSupport::Concern

  def location_uid=(location_uid)
    @location = nil
    write_attribute(:location_uid, location_uid)
  end

  def location
    @location ||= G5Updatable::Location.find_by_uid!(location_uid)
  rescue ActiveRecord::RecordNotFound
    raise ActiveRecord::RecordNotFound.new("Can't find a location for uid '#{location_uid}'")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
g5_updatable-0.3.5 app/concerns/g5_updatable/belongs_to_location.rb
g5_updatable-0.3.4 app/concerns/g5_updatable/belongs_to_location.rb
g5_updatable-0.3.3 app/concerns/g5_updatable/belongs_to_location.rb
g5_updatable-0.3.2 app/concerns/g5_updatable/belongs_to_location.rb
g5_updatable-0.3.1 app/concerns/g5_updatable/belongs_to_location.rb