2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

fix the build

This commit is contained in:
Régis Hanol 2015-09-09 15:34:53 +02:00
parent 31e8309f05
commit 3ee5cea9e2
3 changed files with 15 additions and 18 deletions

View file

@ -13,16 +13,14 @@ class SiteSettings::DbProvider
def all
return [] unless table_exists?
# note, not leaking out AR records, cause I want all editing to happen
# via this API
SqlBuilder.new("select name, data_type, value from #{@model.table_name}").map_exec(OpenStruct)
# Not leaking out AR records, cause I want all editing to happen via this API
SqlBuilder.new("SELECT name, data_type, value FROM #{@model.table_name}").map_exec(OpenStruct)
end
def find(name)
return nil unless table_exists?
# note, not leaking out AR records, cause I want all editing to happen
# via this API
# Not leaking out AR records, cause I want all editing to happen via this API
SqlBuilder.new("SELECT name, data_type, value FROM #{@model.table_name} WHERE name = :name")
.map_exec(OpenStruct, name: name)
.first

View file

@ -24,6 +24,9 @@ class SiteSettings::LocalProcessProvider
end
def save(name, value, data_type)
# NOTE: convert to string to simulate the conversion that is happening
# when using DbProvider
value = value.to_s
settings[name] = Setting.new(name, value, data_type)
end