문제

I'm making a business administration Rails app.

Is there any info available on how I can enable admin users to add a new field to a table? Behind the scenes this would generate and run the migration and I guess some metaprogramming to include the field in the index, show and _form.html.rb views..

도움이 되었습니까?

해결책

You can't run migrations like that, but you can solve the problem.

The answer is here

403-dynamic-forms

If you con't have a subscription, get one. Railscasts is gold for any rails developer

Basically you make a table in the database for the fields to a model.

For instance

class Product
 has_many :product_fields
end   
class ProductFields 
 belongs_to :product
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top