Skip to content
Browse files

Burn inject usage to build hash :fire:

  • Loading branch information...
1 parent f45604a commit 13963fbd9edb6f51686cd093b04be07fbf040ac0 @carlosantoniodasilva carlosantoniodasilva committed Nov 25, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/mail_form/delivery.rb
View
5 lib/mail_form/delivery.rb
@@ -68,7 +68,7 @@ module ClassMethods
#
def attribute(*accessors)
options = accessors.extract_options!
-
+
# TODO: make this not depend on column_names
columns_methods = self.respond_to?(:column_names) ? column_names.map(&:to_sym) : []
attr_accessor *(accessors - instance_methods.map(&:to_sym) - columns_methods)
@@ -154,9 +154,8 @@ def deliver!
# Returns a hash of attributes, according to the attributes existent in
# self.class.mail_attributes.
def mail_form_attributes
- self.class.mail_attributes.inject({}) do |hash, attr|
+ self.class.mail_attributes.each_with_object({}) do |attr, hash|
hash[attr.to_s] = send(attr)
- hash
end
end
end

0 comments on commit 13963fb

Please sign in to comment.
Something went wrong with that request. Please try again.