Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5981459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:56:48+00:00 2026-05-22T21:56:48+00:00

With ActiveResource, a call to MyObject.find(id) gets [self.site]/[self.prefix]/:id.[self.format]. However, the API we’re accessing is

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:56:49+00:00Added an answer on May 22, 2026 at 9:56 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to call an API. I just want use active resource so I
I am using ActiveResource against a non-Rails REST API... in fact even the Rest
I am making an activeresource call to a service, and I'd like some custom
I have a RESTful API call that acts like this: HTTP GET http://addresss:port/settings/{setting} which
I'm trying to get activeresource (on Rails 3.2) working with the Freebase API and
I'm trying to get the account info from Unfuddle API using ActiveResource The url
I am trying to debug an ActiveResource call that is not working. What's the
How can I detect that an active resource find() call returned HTTP 206 instead
I've got a non-Rails RESTful API that I can easily connect to with ActiveResource,
Say I have an ActiveResource which has an schema with several attributes. One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.