With ActiveResource, a call to MyObject.find(id) gets “[self.site]/[self.prefix]/:id.[self.format]”. However, the API we’re accessing is configured slightly differently. Instead of id.file_type we need to access “[self.site]/:id/[self.suffix].[self.format]”.
ie: get http://api_path/:id/tool.json
Is there any way to configure activeresource for this scenario? I’m not finding much in the documentation.
ActiveResource::Base.element_pathis the method that creates the path:I would create a class that redefines element_path, something like this:
(warning: not tested) and then the other ActiveResource models would inherit from CustomApiPath rather than ActiveResource::Base.