This project is archived and is in readonly mode.
Namespacing for activeresource
Reported by Bart ten Brinke | February 25th, 2009 @ 10:25 AM | in 3.x
If you have an Client object in your Rails app and you want to use ActiveResource to get Clients from another application, then these Client objects have to have exactly the same attributes or ActiveResource will break. Because in a real world situation a lot of people call models in their application by the same name, sometimes you do not want ActiveResource to assume this behaviour.
To fix this I added this namespace patch. When a namespace is defined, the ActiveResource resourcename will not be Client, but NameSpaceClient. This will make ActiveResource fall back to it's default 'unknown source' behaviour, making it possible to get remote resources with the same name.
Comments and changes to this ticket
-
José Valim February 25th, 2009 @ 03:28 PM
- Tag changed from activeresource, class, name, namespacing to activeresource, patch
Great! +1
-
Bart ten Brinke March 10th, 2009 @ 07:11 PM
- Tag changed from activeresource, patch to activeresource, patch, verified
It would be really nice if this went in 2.3, together with the XML parser upgrades. It would really make activeresource usable for a lot of people.
-
Jeremy Kemper May 19th, 2009 @ 10:03 PM
- State changed from new to open
Good idea, but the 'namespace' name is too generic.
How about localizing the unknown-constant lookup to a single method that subclasses can override to implement whatever behavior they like.
-
Bart ten Brinke May 19th, 2009 @ 11:16 PM
Have you got a better suggestion then namespace? Localizing the unkown constant lookup via a method missing is pretty much what is happening in AR right now. Refactoring that is a good idea but goes a lot further then this patch :)
-
Dan Pickett May 9th, 2010 @ 05:59 PM
- Tag changed from activeresource, patch, verified to activeresource, bugmash, patch, verified
-
Santiago Pastorino February 2nd, 2011 @ 05:02 PM
- Importance changed from to
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 core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 05:02 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>