lib/skr/models/location.rb in stockor-0.1.9 vs lib/skr/models/location.rb in stockor-0.2
- old
+ new
@@ -3,20 +3,26 @@
# A location that holds inventory
class Location < Skr::Model
has_code_identifier :from=>'name'
+ mount_uploader :logo, Lanes::Concerns::ImageUploader
+
belongs_to :address, export: { writable: true }
has_many :sku_locs
validates :gl_branch_code, :presence => true, :numericality=>true, :length=>{:is=>2}
locked_fields :gl_branch_code
before_validation :set_defaults, :on=>:create
- # @return [Location] the location that's specified by {Skr::Core::Configuration#default_location_code}
+ def get_logo
+ self.logo.present? ? self.logo : Lanes::SystemSettings.config.logo
+ end
+
+ # @return [Location] the location that's specified by {Skr::Configuration#default_location_code}
def self.default
Location.find_by_code( Skr.config.default_location_code )
end
private