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
Currently I am getting the error:
HANDLER ERROR: Undefined prefix RightSide found
/usr/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:389:in `pull'
/usr/local/lib/ruby/1.8/set.rb:195:in `each'
/usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
/usr/local/lib/ruby/1.8/set.rb:195:in `each'
When trying to execute this code in my steps:
Dupe.create "RightSide::Foo", :a_value => '1234'
Dupe.find('RightSide::Foo') {|b| a_value == '1234'}
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.
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 endmodule RightSide::Foo class Foo < ActiveResource::Base self.site = CONFIG['api']['right_side_url'] end endCurrently I am getting the error:
When trying to execute this code in my steps:
Dupe.create "RightSide::Foo", :a_value => '1234' Dupe.find('RightSide::Foo') {|b| a_value == '1234'}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.