ActiveResource::Base.element_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
Я бы создал класс, который переопределяет element_path, что-то вроде этого:
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
(предупреждение: не проверено), а затем другие модели ActiveResource наследуются от CustomApiPath, а не от ActiveResource :: Base.