spree/spree — pull request #2643 by huoxito (2013-03-02 20:12:28+00:00)
Title: Refactor backend mail method

A suggestion to remove the mail_method obj (and table) from Spree and just use ``Spree::Config`` instead. I could never understand why Spree would keep a collection of mail methods when all it needs, and actually uses, is a single one. This method should prove it, it's called by both ``Spree::Core::MailSetting`` and ``Spree::Core::MailInterceptor`` to override the action_mailer configs.

def self.current
where(:environment => Rails.env).first
end

Another reason to remove the MailMethod model is that the table only has an environment and an active attr, besides the Rails defaults (I believe the active attribute is not used anywhere). All other fields are preferences already.

If this get merged in users could use if statements to define custom settings as per environment. e.g.

```ruby
if Rails.env.production?
config.mail_port = "25"
else
config.mail_port = "1025"
end
```

Please let me know what you think. The build still has some failing specs but I think that's related to taxons or something else. I made it in four commits just to state clearly what were the changes. I could squash them into one in case you guys intend to merge it in master.