jphenow/sendgrid_events — pull request #2 by cutalion (2012-08-17 09:22:09+00:00)
Title: Allow users to customize their SendgridEmailRecord

Users can redefine SendgridEmailRecord.create_from_headers! method.
They also have new method in mailer - `sendgrid_email_record_attribute`.

def send_something
sendgrid_email_record_attribute user_id: 12
end

Then `SendgridEmailRecord.create_from_headers!` will be called with
mail headers and this additional attributes.

class SendgridEmailRecord < ActiveRecord::Base
# redefined method in user's app
def self.create_from_headers!(headers, additional_attributes)
create!(:to => headers[:to],
:from => headers[:from],
:subject => headers[:subject],
:user_id => additional_attributes[:user_id]
:status => 'processing')
end
end