Created
June 9, 2011 11:05
-
-
Save paulspringett/1016532 to your computer and use it in GitHub Desktop.
Streamsend ActiveResource fix
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
class Streamsend::Blast < ActiveResource::Base | |
self.site = "https://app.streamsend.com/" | |
self.user = "{login_id}" | |
self.password = "{key}" | |
self.element_name = "blast" | |
private | |
# fix because streamsend rarely includes the type="array" attribute | |
def self.instantiate_collection(collection, prefix_options = {}) | |
collection = collection[self.element_name] if collection.instance_of?(Hash) | |
collection.collect! { |record| instantiate_record(record, prefix_options) } | |
end | |
end |
But you'd obviously need to drop in lines 8-14 into any ActiveResource model, or create a Base model for all your AR models to inherit from, and put it in that
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 12 is the fix