Class | OAuthActiveResource::Resource |
In: |
lib/oauth_active_resource/resource.rb
|
Parent: | ActiveResource::Base |
oauth_connection | [RW] |
has_many allows resources with sub-resources which arent nested to be accessable.
Example: User 123 (example.com/users/123/) has many friends The list of friends can be accessed by example.com/users/123/friends Our class definition:
class User < Resource has_many :friends end user = User.find(123) user.friends.each do |friend| p friend.name end # adding a friend stranger = User.find(987) user.friends << stranger user.friends.save => sends a PUT with collection of friends to http://example.com/users/123/friends