ActiveResource::Base.element_path
is the method that creates the path:
def element_path(id, prefix_options = {}, query_options = nil)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{collection_name}/#{URI.escape id.to_s}.#{format.extension}#{query_string(query_options)}"
end
I would create a class that redefines element_path, something like this:
class CustomApiPath < ActiveResource::Base
def element_path(id, prefix_options = {}, query_options = nil)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{URI.escape id.to_s}/#{collection_name}.#{format.extension}#{query_string(query_options)}"
end
end
(warning: not tested) and then the other ActiveResource models would inherit from CustomApiPath rather than ActiveResource::Base.