Module: Spree::Sample
- Defined in:
- lib/spree/sample.rb
Class Method Summary collapse
Class Method Details
.load_sample(file) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/spree/sample.rb', line 3 def self.load_sample(file) # If file exists within application it takes precedence. path = if File.exist?(File.join(Rails.root, 'db', 'samples', "#{file}.rb")) File.(File.join(Rails.root, 'db', 'samples', "#{file}.rb")) else # Otherwise we will use this gems default file. File.(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 |
.samples_path ⇒ Object
18 19 20 |
# File 'lib/spree/sample.rb', line 18 def self.samples_path Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples')) end |