Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Streamsend ActiveResource fix
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
@paulspringett

This comment has been minimized.

Copy link
Owner Author

@paulspringett paulspringett commented Jun 9, 2011

Line 12 is the fix

@paulspringett

This comment has been minimized.

Copy link
Owner Author

@paulspringett paulspringett commented Jun 9, 2011

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