lib/cas/form_field.rb in cas-cms-0.1.3 vs lib/cas/form_field.rb in cas-cms-1.0.0.alpha1

- old
+ new

@@ -13,16 +13,20 @@ def filename if Rails.env.test? "spec/fixtures/cas.yml" else - "cas.yml" + Cas::CONFIG_PATH end end def load_field @config ||= begin - config_file = YAML.load_file(filename) + begin + config_file = YAML.safe_load_file(filename, aliases: true) + rescue NoMethodError, ArgumentError + config_file = YAML.load_file(filename) + end sites = config_file["sites"] site = sites[@section.site.slug] section = site["sections"] fields = section.find { |key, value| key == @section.slug