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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:42:46+00:00 2026-06-05T02:42:46+00:00

That it is better to ajax in rails with controller return json or return

  • 0

That it is better to ajax in rails with controller return json or return js.erb?
which is faster and why?

  • 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-05T02:42:48+00:00Added an answer on June 5, 2026 at 2:42 am

    I don’t think speed is the issue here (both options will perform more or less equally).

    The keys are maintainability and testability. What do you prefer?

    1. Javascript (worst, rjs, a weird JS/Ruby mixture) scattered all over views on the server side of you app (very, very hard to test).

    2. Centralized JS code that gets data from the server and that can be developed and tested as a unit.

    I definitely prefer this second option: on the AJAX section of your app make the server return JSON and manage the responses with Javascript in the client. Now that Rails ships with CoffeeScript by default (hint: use also underscore), it’s also a joy to write client code.

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

Sidebar

Related Questions

What are some of the better AJAX Treeviews out there that support asynchronous JSON
I've been using JSON to handle AJAX functionality in my rails applications ever since
I hear claims that Ruby on Rails makes web applications ten times faster to
I have a controller ActionResult that returns JSON that I would like to cache.
I know that is better to use Python to call Posix and Win API,
I'm hearing that is better to have one connection open upon app start up
I'm looking for a framework that is better and easier to use than Apache
this is an edit of the original post now that I better understand the
I have two tables: sites has_many users users belongs_to sites Is it better that
I want to learn complete and authoritative knowledge about charset and encoding. That's better

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.