Giter Club home page Giter Club logo

taryneast / hyperactiveresource Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harrikauhanen/hyperactiveresource

38.0 38.0 5.0 426 KB

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.

Home Page: http://github.com/lukegalea/hyperactiveresource/wikis

License: Other

Ruby 100.00%

hyperactiveresource's People

Contributors

harrikauhanen avatar lukegalea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hyperactiveresource's Issues

active_record has_many, :through and active _resource

Hello,
I have many to many relationship between Venue and Catalog

class Venue < ActiveRecord::Base
  has_many :venue_catalogs
  has_many :catalogs, :through => :venue_catalogs
end

class VenueCatalog < ActiveRecord::Base
  belongs_to :venue
  belongs_to :catalog
end

class Catalog < HyperactiveResource
    self.columns = [ :id, :description]
end

when I call url /venues.xml I get
undefined method `quoted_table_name' for Catalog:Class

seems belongs_to HyperActiveResource is not recognizing catalog is not an ActiveRecord.

Rails 3 compatibility

Wanted to use HRes in a Middleware in Rails 3.
Got the following error while starting the app

ruby-1.8.7-p249/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:456:in `load_missing_constant': uninitialized constant ActiveRecord::Errors (NameError)

Maybe I am doing it wrong?

Best Regards

find_all_by_x with empty array

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...

Thanks and regards, Phil

Arrayify

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 and arrayify!

has_one :amodel does not work. I get:
..
hyperactive_resource.rb:669:in has_one': undefined methodarrayify!' for :order_product:Symbol (NoMethodError)
..

ActiveRecord like query cache

Hey,

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.

How do you got around this problem?
Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.