HyperActiveResource extends ActiveResource so it works properly and behaves more like ActiveRecord. Note: you will need to replace ActiveResource's validations.rb for this to work!!! (see wiki for more info). This plugin is aimed at Rails 2.3.X A lot of the functionality here is being drawn into Rails 3.0 Active Resource. See wiki for more info.
Hi,
I would like to discuss the behaviour of dynamic finder "find_all_by_X", when provided a empty array.
When I call
Product.find_all_by_id([])
I expected to get an empty array as result. Since the request builds a url like
/products.xml?
it returns all the records from the resource.
Of course I can and do test argument "blank?" before, but just want to know if this is behaviour as designed...
Arrayify does not handle collections that are already an array. This makes it difficult to work with collections from and index action. The method below works properly.
def arrayify
self.is_a?(Array) ? self : [self]
end
has_one :amodel does not work. I get:
..
hyperactive_resource.rb:669:in has_one': undefined methodarrayify!' for :order_product:Symbol (NoMethodError)
..
i wandered if you already have a solution for this that you use internaly.
If you have an association like self.city and you need to call this method often from many objects but the city in question is always the same it would be nice when the find method is cached somewhere to that at least for this request the resource is only fetched once.