lib/alchemy/page_layout.rb in alchemy_cms-5.3.5 vs lib/alchemy/page_layout.rb in alchemy_cms-5.3.6
- old
+ new
@@ -6,11 +6,11 @@
# Returns all page layouts.
#
# They are defined in +config/alchemy/page_layout.yml+ file.
#
def all
- @definitions ||= read_definitions_file
+ @definitions ||= read_definitions_file.map(&:with_indifferent_access)
end
# Add additional page definitions to collection.
#
# Useful for extending the page layouts from an Alchemy module.
@@ -162,10 +162,14 @@
# Reads the layout definitions from +config/alchemy/page_layouts.yml+.
#
def read_definitions_file
if File.exist?(layouts_file_path)
- YAML.safe_load(ERB.new(File.read(layouts_file_path)).result, YAML_WHITELIST_CLASSES, [], true) || []
+ Array.wrap(
+ YAML.safe_load(
+ ERB.new(File.read(layouts_file_path)).result, YAML_WHITELIST_CLASSES, [], true
+ ) || []
+ )
else
raise LoadError, "Could not find page_layouts.yml file! Please run `rails generate alchemy:install`"
end
end