Sha256: b81e299ab81a8a50a9e7a8c7d7c6a0082669aa1060f71eb579e07cb34a5ef301
Contents?: true
Size: 782 Bytes
Versions: 12
Compression:
Stored size: 782 Bytes
Contents
module Spree module Sample def self.load_sample(file) # If file exists within application it takes precendence. path = if File.exist?(File.join(Rails.root, 'db', 'samples', "#{file}.rb")) File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb")) else # Otherwise we will use this gems default file. File.expand_path(samples_path + "#{file}.rb") end # Check to see if the specified file has been loaded before unless $LOADED_FEATURES.include?(path) require path puts "Loaded #{file.titleize} samples" end end private def self.samples_path Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples')) end end end
Version data entries
12 entries across 12 versions & 1 rubygems