the-refinery / sparkpost_rails

Sparkpost delivery method for ActionMailer
MIT License
66 stars 61 forks source link

Add MessageData module to include `sparkpost_data` in Mail::Message #62

Open silvabox opened 5 years ago

silvabox commented 5 years ago

sparkpost_data is addded to the message object through metaprogramming in the mail method. Instances of Mail::Message created outside of this method (e.g. deserializing from a data store) will therefore not have this attribute defined. This change separates the attribute definition to ensure it exists on the object's class and not just the instance's singleton class.

Closes #59