43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/sql_valued_columns.rb', line 43
def attributes_with_quotes_with_sqlcolumns(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys)
h = self.attributes_with_quotes_without_sqlcolumns(include_primary_key, include_readonly_attributes, attribute_names)
names = h.keys
names.each do |name|
if self.class.sql_columns[name]
function, args, raw = self.class.sql_columns[name]
unless raw
fmt_args = args.collect do |a|
case a
when Symbol
connection.quote(read_attribute(a.to_s))
when Proc
connection.quote(a.call(self))
when String
str = a
if a =~ /\#\{[^\}]+\}/
str = val('"' + str + '"')
end
connection.quote(str)
else
connection.quote(a)
end
end
h[name] = "#{function}(#{fmt_args.join(",")})"
else
h[name] = function
end
end
end
h
end
|