Note that there are some explanatory texts on larger screens.

plurals
  1. POUsage of MVC in convenient way in Rails
    primarykey
    data
    text
    <p>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.</p> <p>Page contains a bunch of "Listings" with search and sort capabilities,CRD actions, forms for creating new and manage existing association records.</p> <p>All this stuff is managed by ArticleController edit and update actions and bunch of partial templates for each listing.</p> <p>I want to extend functionality more by adding additional search tables to find records for association. And later I'll add some other features.</p> <p>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: </p> <pre><code>/articles/1/edit/authors </code></pre> <p>And what should be the name of this controller? Should it be children of ArticleController or PeopleController or ApplicationController?</p> <p>or maybe all okay and I am paranoiac?)</p> <p><strong>UPD</strong></p> <p>All MVC conditions are sctictly met. Question is:</p> <p>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.</p> <p>If someone dont understand me, lets ask in different way:</p> <p>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.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload