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

  • Home
  • SEARCH
  • 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 3874652
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:10:35+00:00 2026-05-19T22:10:35+00:00

I have an article controller, which manages all article relations like authors, translations, related

  • 0

I have an article controller, which manages all article relations like authors, translations, related articles and so on in one update action at this moment.

Page contains a bunch of “Listings” with search and sort capabilities,CRD actions, forms for creating new and manage existing association records.

All this stuff is managed by ArticleController edit and update actions and bunch of partial templates for each listing.

I want to extend functionality more by adding additional search tables to find records for association. And later I’ll add some other features.

I feel that this way (all association management in one edit page) is far far from convenient. So, maybe, better is to create some special controllers for each listing like:

/articles/1/edit/authors

And what should be the name of this controller? Should it be children of ArticleController or PeopleController or ApplicationController?

or maybe all okay and I am paranoiac?)

UPD

All MVC conditions are sctictly met. Question is:

Is it good to manage all relations in one controller. Not only add/remove relation, sometimes creating a newone, like @article.authors.find_or_create_by_name(name). Relations in view are not simply select tags! They are fullyfeachured tables with own search, sort, paginate capabilities.

If someone dont understand me, lets ask in different way:

how to create a “subcontroller”: if we have ArticleController and its edit action. ArticleController should manage only fields in Article model. And a bunch of subcontrollers should manage relations.

Why I am need it?
Lets add a AJAX to such page: no serious problems are met, but on every AJAX call ArticleController.update/edit actions a query and thay may do some unnessesary work like building Arel relations for models, that will never be used. I like to divide work into small independent pieces, not to build a one huge Controller, that can do everything.

  • 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-19T22:10:36+00:00Added an answer on May 19, 2026 at 10:10 pm

    You article controller shouldn’t manage relations. That should be in your model. Look into active record callbacks. You can do everything related to managing your authors, translations, etc in a callback. For example, in a after_update callback

    You also want to be using nested resources. For example, your authors are nested inside your articles

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

Sidebar

Related Questions

I have a news site with articles tagged in categories. My Controller is called
I have checked with the wikipedia article , and it seems like it is
I have been reading the proper article in MSDN, Strong-Named Assemblies and a related
I have made some code which exports some details of a journal article to
Essentially what I have is an entity class (Article) and one article may belong
I have the following scenario: my website displays articles (inputted by an admin. like
I have lots of article store in MS SQL server 2005 database in a
Per this helpful article I have confirmed I have a connection pool leak in
I have a pretty generic Article model, with m2m relation to Tag model. I
I have quickly read (and will read with more care soon) the article 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.