You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently developing a service that acts as a middle-man for two other services. On either side, we have Foo model and the middle transports them across. We accomplished the same-name model problem in our middle man by subclassing our ActiveResource models like so:
module LeftSide::Foo
class Foo < ActiveResource::Base
self.site = CONFIG['api']['left_side_url']
end
end
module RightSide::Foo
class Foo < ActiveResource::Base
self.site = CONFIG['api']['right_side_url']
end
end
The other issue we'll have is the fact that API calls are reduced down to the path. In both my LeftSide and RightSide API's, the routes are the same. I haven't had a chance to test conflicts between model URLs yet, but I have a feeling this is going to fail.
The text was updated successfully, but these errors were encountered:
hi bloudermilk. thanks for using dupe. i think the problem stems from trying to call the duped resource "RightSide::Foo". when you dupe a resource, it essentially creates a glorified hash, and eventually a to_xml will be run on the hash, with the root node set to the name of the resource. so in this case, it sounds like it's setting the root node to RightSide::Foo, which is essentially a namespaced XML node, which i think is probably why REXML is complaining. the solution: call your resource "right_side_foo", or even just "foo". if during some tests, your testing the left side foo, then during that test, create mocked resources named "foo", and then create the intercept mocks to respond to that particular url. same for the right side foo.
I am currently developing a service that acts as a middle-man for two other services. On either side, we have Foo model and the middle transports them across. We accomplished the same-name model problem in our middle man by subclassing our ActiveResource models like so:
Currently I am getting the error:
When trying to execute this code in my steps:
The other issue we'll have is the fact that API calls are reduced down to the path. In both my LeftSide and RightSide API's, the routes are the same. I haven't had a chance to test conflicts between model URLs yet, but I have a feeling this is going to fail.
The text was updated successfully, but these errors were encountered: