Created
November 3, 2009 20:04
-
-
Save conversionfoundry/225376 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Component::QuoteManager | |
class Configuration < Base | |
unloadable | |
# This is a hook that gets called whenever BreezeHQ is sending out a form response. | |
# The email still gets sent out, but this will let you grab the form responses | |
# when they're created. | |
# For sanity reasons, return message at the end. | |
def send_form_response(message) | |
QuoteProcessor.new(message.id).send_later(:process!) | |
message | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Component::QuoteManager | |
class QuoteProcessor < Struct.new(:quote_id) | |
# Called asynchronously by delayed_job | |
# so you can do all your SQL stuff in here | |
# (easier than running a separate rails app on the server) | |
def process! | |
# ... | |
end | |
def quote | |
@quote ||= Component::Form::Response.find(quote_id, :conditions => { :site_id => site_id }) | |
end | |
def quote_data | |
@quote_data ||= quote.values | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment