r/rails•
eskimoFry

can I generate a bunch of forms and routes to those in rails DYNAMICALLY?

I want to read a database table with rails. Using the column information I got, I want to create a form for getting data for these columns. Basically, Dynamic CRUD. Is it possible to do this in Rails?

So far, the guide is only going into how to manually write form views and connect them to models that take care of tables themselves. They abstract the process of storing data. I want to abstract the process of building the model based on the database.

EDIT: put it another way: my tables already exist. I want to build models for them and then build the forms for the models without specifying the fields in the view.. something like the pseudocode below:

columns = database.columns("StudentTable")
tableModel = model(columns)
form = generateForm(tableModel)
return form.linkTo()
<BR>

EDIT 2: why the downvotes people? What is wrong with my question?

Posted Sep 16, 2015, 7:22 AM UTC · edited

28
Loading comments…