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 is exists within application it takes precendence. if File.exists?(File.join(Rails.root, 'db', 'samples', "#{file}.rb")) path = File.(File.join(Rails.root, 'db', 'samples', "#{file}.rb")) else # Otherwise we will use this gems default file. path = File.(samples_path + "#{file}.rb") end # Check to see if the specified file has been loaded before if !$LOADED_FEATURES.include?(path) require path puts "Loaded #{file.titleize} samples" end end |
.samples_path ⇒ Object
19 20 21 |
# File 'lib/spree/sample.rb', line 19 def self.samples_path Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples')) end |