diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-10-16 23:17:14 -0400 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-17 12:26:47 -0200 |
commit | f527f9097b20d4c6178bcdd70a2be11a129bc866 (patch) | |
tree | a8f3b55e99e7d46097eb1d07cc6e6fc99c5e06b1 /activerecord/lib | |
parent | ea14396c455b0816e87abe424275290fc4b09b32 (diff) | |
download | rails-f527f9097b20d4c6178bcdd70a2be11a129bc866.tar.gz rails-f527f9097b20d4c6178bcdd70a2be11a129bc866.tar.bz2 rails-f527f9097b20d4c6178bcdd70a2be11a129bc866.zip |
no need to check for nil
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/read.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 01699746d8..a487bcf78b 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -85,7 +85,7 @@ module ActiveRecord def _read_attribute(attr_name) attr_name = attr_name.to_s 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 unserializable_attribute?(attr_name, column) unserialize_attribute(attr_name) diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index f5331bb8a9..e30b481fe1 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -114,9 +114,9 @@ HEADER column.type.to_s end 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[:scale] = column.scale.inspect if !column.scale.nil? - spec[:null] = 'false' if !column.null + spec[:precision] = column.precision.inspect if column.precision + spec[:scale] = column.scale.inspect if column.scale + spec[:null] = 'false' unless column.null spec[:default] = default_string(column.default) if column.has_default? (spec.keys - [:name, :type]).each{ |k| spec[k].insert(0, "#{k.inspect} => ")} spec |