Active Resource Associations #70

Closed
wants to merge 41 commits into
from

Conversation

Projects
None yet
6 participants
Contributor

gramos commented Oct 6, 2010

I figured out that my last pull request http://github.com/rails/rails/pull/68 is wrong, so I did this new one with the right commits, thanks and I'm sorry for the mistake.

gramos added some commits Sep 27, 2010

@gramos gramos - added associations module
- added asociations unit test file
7d3da5b
@gramos gramos - added first version of ActiveResource has_one associaion method 1cbff55
@gramos gramos - Active Resrource associations, has one should return the associated…
… resource
e440e23
@gramos gramos - fix ActiveResource has_one association
  resource_id column is on the associated resource (belogns_to)
- refactoring association test cases
95d5305
@gramos gramos - remove instance variable warnings e0cf708
@gramos gramos - ActiveResource has_one association
  test_accessor_should_return_nil_when_the_does_not_has_an_associated_resource
b8c08a9
@gramos gramos - Active Resource has_one association
  test_should_assign_a_new_project_manager
af10377
@gramos gramos - tiny refactoring, remove duplication 79c4e02
@gramos gramos - added belongs_to association to ActiveResource 8a7f3d9
@gramos gramos - ActiveResource test_belongs_to_accessor_should_return_the_associate…
…d_project
55156b1
@gramos gramos - Active Resource
  test_belongs_to_accessor_should_return_nil_when_the_does_not_has_an_associated_resource
51e9cc0
@gramos gramos - Active Resource associations refactoring
  * Added method set_resource_instance_variable(resource)
  * added modules InstanceMethods and ClassMethods
  * include instead of extend in ActiveResource::Base
df72be3
@gramos gramos - added ActiveResource has_many association 59dc21a
@gramos gramos - fix missing old way to set resource instance variable 0b78260
@gramos gramos - ActiveResource added writter to belongs_to association 9ac1329
@gramos gramos - ActiveResource associations, added some comments 02d5808
@gramos gramos - ActiveResource association remove :class_name option
  is not implemented yet
6a1507c
@gramos gramos - ActiveResource Associations, better name for hash_options 7ab2337
@gramos gramos - ActiveResource, only constantize the resource class
  when is used it.
47caf7e
@gramos gramos - ActiveResource assocition belongs_to dont save the obj. 4b6a817
@gramos gramos - ActiveResource added
  test_has_many_accessor_should_return_the_an_array_with_the_associated_milestones
9b2d30b
@gramos gramos - ActiveResource
  test_has_many_accessor_should_return_the_an_empty_array_when_it_does_not_has_milestones
25207f8
@gramos gramos - Active Resource associations, refactoring remove some duplication 0c05f0e
@gramos gramos - ActiveResource associaions
  test_has_many_accessor_should_return_the_an_array_including_the_added_obj
ee50409
@gramos gramos Active Resource has_many association, change eval by instance_eval fc12bec
@gramos gramos - Active Resource associations, dont need send with eval 93cc66a
@gramos gramos - ActiveResoruce association added method delete to has_many
  association
9c3e20f
@gramos gramos - ActiveResource added clear method to has_many association 3666989
@gramos gramos - Active Resource Fix has_many association, update resource list
  after some methods
8edb72c
@gramos gramos - ActiveResource association has_many, added method resource= 7223ca7
@gramos gramos - ActiveResource association has_many fix resource=
  should set an array with the added methods
ccd217e
@gramos gramos - added ActiveResoruce::Associations::AssociationCollection
  move all related methods to this new class
b13fe47
@gramos gramos - ActiveResource::Associosiations::AssociationCollection, added missi…
…ng file
c2bea8c
@gramos gramos - some changes about coding style 723f303
@gramos gramos - ActiveResource::Associations, simple cache added (like AR)
  project.milestones             # fetches milestones
  project.milestones.size        # uses the milestone cache
  project.milestones(true).size  # fetches milestones
43303a5
@gramos gramos - added documentation for ActiveResource::Associations d169a9f
@gramos gramos - added cache doc ActiveResource::Associations 2d7a9d9
@gramos gramos - ActiveResource::Associations, update doc. 30ed5dd
@gramos gramos - ActiveResource::Associations, fix some typo error in doc
- tiny fix in set_resource_instance_variable
b4bcc1f
@gramos gramos - ActiveResource::Associations, added doc for has_one d55f51e
@gramos gramos - ActiveResource::Associations, Fix doc e528f0e
Member

josevalim commented Oct 6, 2010

I have just one question from looking at your tests. What if instead of hitting "/project_managers.xml?project_id=2", I would like my association to hit "/projects/2/project_managers"? Is that possible to achieve with the current code?

Contributor

gramos commented Oct 6, 2010

With the current code not, bu I could add an option like this:

has_many :from => "/projects/2/project_managers"

this is a first tiny version, I can do more work and implement new ideas after my patch is merged to rails.

Do you think that is better use this route by default? "/projects/2/project_managers"

Contributor

gramos commented Oct 6, 2010

sorry I mean has_many :from => "/projects/:id/project_managers"

Contributor

bkeepers commented Oct 7, 2010

Nice work. I like it.

This doesn't appear to have been merged into rails. Should it still be open?

Contributor

gramos commented Nov 18, 2011

I would like to see the reasons why will not be merge in a comment here.

Contributor

gramos commented Nov 18, 2011

I would like to see the reasons why will not be merge here, as a comment

cicloid commented Jan 10, 2012

What is the status of this pull?

Contributor

smathy commented Feb 7, 2012

Seems like a great feature, I'd definitely like to see it updated to support the standard nested resource route before merge though.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment