diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-05-04 10:52:09 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-05-04 10:52:09 -0300 |
commit | 816efacb1f619a85cc5b3425c216bb0c0c766d18 (patch) | |
tree | d97968f952eb05c822e87a5c7a532bcdbbcb7bfd /activerecord/lib | |
parent | 872a17d2a985274923cb8adc8aec8c3d22fe0b67 (diff) | |
download | rails-816efacb1f619a85cc5b3425c216bb0c0c766d18.tar.gz rails-816efacb1f619a85cc5b3425c216bb0c0c766d18.tar.bz2 rails-816efacb1f619a85cc5b3425c216bb0c0c766d18.zip |
Simplify unless conditional with OR
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 435bdf61e5..46827b0dcd 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -393,10 +393,8 @@ module ActiveRecord def column_for(table_name, column_name) # :nodoc: column_name = column_name.to_s - unless column = columns(table_name).detect { |c| c.name == column_name } - raise ActiveRecordError, "No such column: #{table_name}.#{column_name}" - end - column + columns(table_name).detect { |c| c.name == column_name } || + raise(ActiveRecordError, "No such column: #{table_name}.#{column_name}") end end end |