rails/rails — comment on commit 218c2729384be487b7b743a58ac39753cb5a8856
File: actionpack/lib/action_controller/metal/conditional_get.rb line 45
By eloyesp:

I think it could be better to use `case` instead of `if` because it is easier to extend, it could catch errors (when it is not a hash nor a record), and it could be easier to read.

``` ruby
case record_or_options
when Hash
options = record_or_options
options.assert_valid_keys(:etag, :last_modified, :public)
when ActiveRecord::Base
record = record_or_options
options = { :etag => record, :last_modified => record.try(:updated_at) }.merge(additional_options)
else
raise ArgumentError, "It must be a Hash or a Record"
end