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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:21:15+00:00 2026-05-12T07:21:15+00:00

Should AJAX calls that are not RESTful be: put in the controller that most

  • 0

Should AJAX calls that are not RESTful be:

  1. put in the controller that most suits their functionality/view, or
  2. bundled together into their own separate ‘Ajax’ controller?

I’ve been doing 1, but I’ve just read this (2725 diggs) article
http://zygote.egg-co.com/10-dirty-little-web-development-tricks/ (see point 9)
and this chap opts for method 2. But he is a PHP developer though.

One benefit could be that 2 might clean up the routes by doing something like ‘ajax/:action’ instead of adding members to restful routes.

It seems like a 6.5 of one, half a baker’s dozen of the other type thing.

Which option do you go for?

  • 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-12T07:21:16+00:00Added an answer on May 12, 2026 at 7:21 am

    I prefer the first approach:

    1. it’s semantically consistent. if an Ajax action involves resource XXX, you (and other coders) will know where to find things in your application, thanks to Rails conventions.
    2. if your application is heavy on Ajax (and nowadays most of them are), you will end up with a behemoth AjaxController that negates the whole RESTful thing. The rest of your controllers will be there just to provide gracefully degraded non-javascript CRUD actions.
    3. Similarly, testing your Ajax controller will tend to be somewhat messy because you will have to set up scenarios –load fixtures, mocks, etc. for each and every “ajaxified” resource of your app.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a web application that will use a lot of ajax calls. The
I have a site that calls AJAX. It works at my office, where I
I'm building a mobile web application that may or may not rely on ajax,
I would like to use a setTimeout function so that Ajax calls are only
I am creating a web application that uses JQuery's AJAX calls as it deals
I know that ajax calls are asynchronous but there are situations like some synchronous
I have two jQuery Ajax calls that I'm combining on a page. I'm stuck
I have a little ajax call that calls rails: $.ajax({ type: POST, url: '...',
I've been successfully WebForms for AJAX calls with relatively complex set of parameters (called
What's the best way to implement user controls that require AJAX callbacks? I want

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.