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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:25:10+00:00 2026-05-15T19:25:10+00:00

I am designing a REST api for one of my applications & considering using

  • 0

I am designing a REST api for one of my applications & considering using RoR for the same and had a few questions that I was wondering if Rails can support before I can decide on RoR –

1) does rails support setting HTTP response code status. So I want something like this

if customer_save_fail
 response.status_code = 500
end

2) in rails is there a way to execute straight up SQL statement, i want this for complex queries & dont want to use ActiveRecord. I am guessing I can use DBI gem for this? Is there any other way? that integrates with Rails. Also I need a way to convert the resultsets returned by straight queries into JSON, something like to_json. Can I achieve something like this with RoR out of the box?

Thanks all for your inputs.

  • 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-15T19:25:11+00:00Added an answer on May 15, 2026 at 7:25 pm

    1) Yes, Rails has mappings for the HTTP status codes which you can call from your controller actions with head (as one option). See here for the list.

    2) If you want to stay in or close to SQL in your application then you have options within AR or you could use another ORM like Sequel. Examples of the later approach here.

    UPDATE: Expanding on detail above

    1) You can respond with a body and a status in your controller action. For example.

    respond_to do |format|
      format.html
      format.json { render :json => @some_object.to_json, :status => :not_implemented }
    end
    

    2) The execute interface is pretty low-level and returns an result object which is an instance of your particular database adapter’s result. For example MySQL returns a MySQL::Result. If you need to process the results in a more abstracted manner you might like to take a look at the wrappers here

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

Sidebar

Related Questions

I'm working on designing a REST API that can respond with a variety of
We are currently designing a REST API that we want to publish in a
I am designing a REST API one of my resources is all about to
I am designing a rails rest API that I would like to expose either
I'm implementing an API using authentication based on this article: http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ And this related
I'm designing a web service that serves up JSON through a REST API. This
I'm designing a REST API. What response should a server send to mean I've
I am designing a JAX-RS REST Server using Clojure and RESTEasy . It is
I am designing a REST API where some resources can be filtered through query
I am designing a REST API for a web application. I want to clearly

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.