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 8725943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:09:15+00:00 2026-06-13T08:09:15+00:00

I have been pondering about developing a new application with rails (probably without models?).

  • 0

I have been pondering about developing a new application with rails (probably without models?). What I meant is; backend will be written in any other language and that will provide the RESTful APIs, which will be consumed by Rails app.

Since backend API will take care of all data CRUD actions and rails app will not have access to database directly. So there is no use of rails model in such architecture?

I can directly make curl call to APIs from controllers too, but I wish to keep my controller skinny while fat models.

Or other way, API curl calls can be made in the models and it can behave like data CRUD being done to the database in that model.

In any of above scenarios, I will not be able to get benefit of many rails features or gems (such as friendly_id) which works on active records/ORM.

I am really confused as which way I should go? And what is the best practice? What architecture you can suggest? I definitely wants to keep my backend completely decoupled and providing only RESTful apis only.

Thanks in advance.

  • 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-06-13T08:09:16+00:00Added an answer on June 13, 2026 at 8:09 am

    Take a look at ActiveResource.

    You’ll end up with models, but most will only take up one line.

    Say your api service has a url like: http://api.fart.com/products.json which spits out a list of products. In your rails app that will be consuming this data, create a Product model inheriting from ActiveResource. First, set your api url for activeresource.

    class ActiveResource::Base
      self.site = "http://api.fart.com"
    end
    

    Next, define a Product class.

    class Product < ActiveResource::Base; end
    

    Now, in your controllers, you can do:

    Product.all
    

    And it should hit “http://api.fart.com/products.json” and return the good stuff.

    Obviously this is a quickly contrived example, but I have recently used it for a similar situation and it worked great.

    ///////////////

    see example applications for basic concept.

    ///////////////

    Per your questions and your pull requests on github I understand what you are trying to do now. ActiveResource does not come with a where method – however, it’s find method has an options argument that supports a params hash.

    Rails controller with query params

    def index
      @products = Product.find :all, params: { country: "Brazil", price: 500 }
    end
    

    This will hit our Sinatra route at api.fart.com/products.json?country=Brazil&price=500

    # Assume we are using ActiveRecord/DataMapper or the like
    get "/products.json" do
      @products = Product.where country: params[:country], price: params[:price].to_i
      json products: @products
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an MVC3 application and have been wondering about the following. Should
I have been pondering about this for some time. How do you pick a
I have been developing a new online game for the past year now. The
I have been developing in rails for the past 1.5 years .. however ,
I have been pondering about my homework question for a while. I welcome (and
I have been wondering about how people manage their strings if they are likely
I have been wondering about the following lines of code [self performSelector:@selector(myMethod) withObject:self afterDelay:1.0];
I have been wondering about the reload() function in python, which seems like it
I have been wondering about the performance of regular expression implementations lately, and have
Something I have been wondering about properties for a while. When you are using

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.