There are some great suggestions here.
I think it's worth noting that you can treat an ActiveRecord model as a hash like so:
@customer = Customer.new( name: "John Jacob" )
@customer.name # => "John Jacob"
@customer[:name] # => "John Jacob"
@customer['name'] # => "John Jacob"
Therefore, instead of generating a hash of the attributes, you can use the object itself as a hash.