Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support for "<<" on associations #31

Closed
educobuci opened this Issue Jun 13, 2012 · 1 comment

Comments

Projects
None yet
2 participants

I think it would be great to support the "<<" operator on associations since there are many situations where you just want to add an item to an association, today it is only possible to replace all the association items at once.
My first idea was to overwrite the "<<" operator in the ARes association class (is it just an Array?), track all changes made and, in the save method, make a second call to "push" the new items on the association, for instance:

PUT /post/123/comments -d comments[][body]="this is a comment"

Or even add an existent item:

PUT /post/123/comments -d comments[][id]=456

I'm not sure so I was wondering if you have a better solution, maybe I can borrow some ideas from AR. What do you think?

Thanks

@rails-bot rails-bot bot added the stale label May 5, 2017

rails-bot bot commented May 5, 2017

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.

If it is an issue and you can still reproduce this error on the master branch,
please reply with all of the information you have about it in order to keep the issue open.

If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.

Thank you for all your contributions.

Owner

rafaelfranca commented May 5, 2017

This issue has been automatically marked as stale because it has not been commented on for at least three months.

The resources of the Rails team are limited, and so we are asking for your help.

If it is an issue and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.

Thank you for all your contributions.

@rails-bot rails-bot bot closed this May 13, 2017

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