in Education by
To configure the admin settings of my app I made a Admin controller and a AdminConfig model. The Admin controller have several categories (system,files,folders,…) and I wanted to easily separate them in the AdminConfig model by setting a category column in the db. But I really want to do it in a RESTful way and I don't know how to do it with rails. Rails want to edit each db row separately, but I want to group them. example: on the files category I have: extension to look for exif tags to ignore subfolder depth each one is a separate entry in the AdminConfig model like that: name | value| category extension | .jpg,.png,.avi | files exif_tag | nil | files subfolder_depth | 3 | files (sorry table not working here) So I want to show all of them on the page and when I edit them I want to update them all. But I don't know how to do it properly. I can do it my way obviously or modify the DB so one row == one category but thats not how I want to achieve it because it'll be more difficult to add more settings after. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If all of that settings belong to a same collection (e.g. several ExifTag models) – you can patch a collection, that's not prohibited in REST (though you'll have to define your own action, there's no predefined one for patching a collection in Rails). PATCH [{id: 3, name: 'Paul'}, {id: 4, name: 'Dan'}] If all that settings belong to one model – you can patch that model and pass data to other models as nested attributes, Rails allows you to do that. PATCH {id: 1, hobbies_attributes: [{id: 1, name: 'Hiking'}], house_attributes: { location_attributes: { city: 'Vancouver' }} If non of these, like you want to patch 2 different models unrelated to each other - then there's no "healthy" way to do that in REST. I can suggest to go with some fancy frontend, which will send different requests to different routes upon editing, updating different models; That would be the cleanest way.

Related questions

0 votes
    To configure the admin settings of my app I made a Admin controller and a AdminConfig model. The Admin ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a company table and I want to check the existence of multiple column to remove them. class ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    I added a table that I thought I was going to need, but now no longer plan on using it. How ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    Insertion of a large number of entries at a time into an index is referred to as __________ of the ... Answers, Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    For all the labels, multiple entries are captured suffixed as 0 and 1 in the CSV file. Can you ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    The ADT list is more general than common lists and has entries that are objects of the same type. Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    Which key do we use to edit the content of more than one sheet at a time ? Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
0 votes
    Am trying to create a proxy for my hana db which will be called from a lamda function to write to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Am trying to create a proxy for my hana db which will be called from a lamda function to write to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I have a user model that has many fields (let's say 30 for this example). When the user signs ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    The ____________ is activated automatically every time you edit a Repository object. A. Change request B. SAP architecture C. Transport Request D. Transport Organizer...
asked Feb 20, 2023 in Technology by JackTerrance
0 votes
    I have an application in which I am storing time values in an array. The time is getting stored ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    I know there are several plugins that do asynchronous processing. Which one is the best one and why? The ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm wanting a method called same_url? that will return true if the passed in URLs are equal. The ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
...