提交 f527f909 编写于 作者: N Neeraj Singh 提交者: Santiago Pastorino

no need to check for nil

Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
上级 ea14396c
...@@ -85,7 +85,7 @@ def read_attribute(attr_name) ...@@ -85,7 +85,7 @@ def read_attribute(attr_name)
def _read_attribute(attr_name) def _read_attribute(attr_name)
attr_name = attr_name.to_s attr_name = attr_name.to_s
attr_name = self.class.primary_key if attr_name == 'id' attr_name = self.class.primary_key if attr_name == 'id'
if !(value = @attributes[attr_name]).nil? if (value = @attributes[attr_name])
if column = column_for_attribute(attr_name) if column = column_for_attribute(attr_name)
if unserializable_attribute?(attr_name, column) if unserializable_attribute?(attr_name, column)
unserialize_attribute(attr_name) unserialize_attribute(attr_name)
......
...@@ -114,9 +114,9 @@ def table(table, stream) ...@@ -114,9 +114,9 @@ def table(table, stream)
column.type.to_s column.type.to_s
end end
spec[:limit] = column.limit.inspect if column.limit != @types[column.type][:limit] && spec[:type] != 'decimal' spec[:limit] = column.limit.inspect if column.limit != @types[column.type][:limit] && spec[:type] != 'decimal'
spec[:precision] = column.precision.inspect if !column.precision.nil? spec[:precision] = column.precision.inspect if column.precision
spec[:scale] = column.scale.inspect if !column.scale.nil? spec[:scale] = column.scale.inspect if column.scale
spec[:null] = 'false' if !column.null spec[:null] = 'false' unless column.null
spec[:default] = default_string(column.default) if column.has_default? spec[:default] = default_string(column.default) if column.has_default?
(spec.keys - [:name, :type]).each{ |k| spec[k].insert(0, "#{k.inspect} => ")} (spec.keys - [:name, :type]).each{ |k| spec[k].insert(0, "#{k.inspect} => ")}
spec spec
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册