app/models/cms_snippet.rb in lucy_cms-0.0.3 vs app/models/cms_snippet.rb in lucy_cms-0.0.4
- old
+ new
@@ -27,22 +27,22 @@
load_for_slug(cms_page.cms_site, slug) || new(:slug => slug)
end
# Attempting to initialize snippet object from yaml file that is found in config.seed_data_path
def self.load_from_file(site, name)
- return nil if LucyCMS.config.seed_data_path.blank?
- file_path = "#{LucyCMS.config.seed_data_path}/#{site.hostname}/snippets/#{name}.yml"
+ return nil if LucyCms.config.seed_data_path.blank?
+ file_path = "#{LucyCms.config.seed_data_path}/#{site.hostname}/snippets/#{name}.yml"
return nil unless File.exists?(file_path)
attributes = YAML.load_file(file_path).symbolize_keys!
new(attributes)
rescue
raise "Failed to load from #{file_path}"
end
# Wrapper around load_from_file and find_by_slug
# returns layout object if loaded / found
def self.load_for_slug!(site, slug)
- if LucyCMS.configuration.seed_data_path
+ if LucyCms.configuration.seed_data_path
load_from_file(site, slug)
else
# FIX: This a bit odd... Snippet is used as a tag, so sometimes there's no site scope
# being passed. So we're enforcing this only if it's found. Need to review.
conditions = site ? {:conditions => {:cms_site_id => site.id}} : {}