RoR, How do I simulate this?

I asked this question before, but I was very vague, and many people suggested that since I am just starting out with Ruby and RoR, it might be better if I focus on "Hello World!". first. I appreciate that the answers were honest, but this is part of my project, so I have to do this. And I want everything to be done correctly, therefore, problems arose in the future.

I am trying to do the following:

I am creating a web application that basically allows the user to create a table. They name the table and add several columns (fields). Then they add records (rows), like a regular table.

So, for example, the user can create a table called "High-Scores". then add the fields "Name", "Points", "Achievements". These 3 will be columns. Then they can add a record, for example, "John", "123", "Gold".

How would I simulate this using a Base-Base subclass? In principle, from what I have so far learned from the textbook, models have predefined fields. Now, I have dynamic fields.

Thank you for your help.

+4
source share
1 answer

It depends on your requirements. You should not create new tables for each user, unless that is the specific purpose of your application. If you just want the user to enter data into a β€œtable” on his web page, you can simulate a table in four tables, one for TableName , one for ColumnName , one for each TableEntry and one for each column in TableEntry called EntryValue .

It would be difficult to create a presentation for this, but possible.

+1
source

Source: https://habr.com/ru/post/1381070/


All Articles