Sha256: 6aa7551cc395b2bb7a5bcb06e5a55a7bc152c14fc97915f4c5bfb0d20b51f1c4
Contents?: true
Size: 741 Bytes
Versions: 1
Compression:
Stored size: 741 Bytes
Contents
module ConfigurableEngine module ConfigurablesControllerMethods def show @keys = Configurable.keys render 'configurable_engine/configurables/show' end def update failures = Configurable .keys.map do |key| Configurable.find_by_name(key) || Configurable.create {|c| c.name = key} end.reject do |configurable| configurable.value = params[configurable.name] configurable.save end if failures.empty? redirect_to(action: :show, :notice => "Changes successfully updated") else flash[:error] = failures.flat_map(&:errors).flat_map(&:full_messages).join(',') redirect_to(action: :show) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
configurable_engine-2.0.2 | lib/configurable_engine/configurables_controller_methods.rb |