lib/alchemy/page_layout.rb in alchemy_cms-2.5.0.b5 vs lib/alchemy/page_layout.rb in alchemy_cms-2.5.0.b9

- old
+ new

@@ -12,11 +12,11 @@ end end # Returns all layouts defined in +config/alchemy/page_layout.yml+. def all - @@definitions ||= read_layouts_file + @@definitions = read_layouts_file end # Add additional pagelayout definitions. I.E. from your module. # Call +Alchemy::PageLayout.add(your_layout_definition)+ in your engine.rb file. # You can pass a single layout definition as Hash, or a collection of pagelayouts as Array. @@ -98,14 +98,14 @@ # Reads the layout definitions from +config/alchemy/page_layouts.yml+. def read_layouts_file if File.exists? "#{Rails.root}/config/alchemy/page_layouts.yml" layouts = YAML.load_file "#{Rails.root}/config/alchemy/page_layouts.yml" + # Since YAML returns false for an empty file, we have to normalize it here. + layouts || [] else raise LoadError, "Could not find page_layouts.yml file! Please run: rails generate alchemy:scaffold" end - # Since YAML returns false for an empty file, we have to normalize it here. - layouts || [] end end end end