开发者

Rails fixtures or similar for creating data within an app

开发者 https://www.devze.com 2023-04-09 13:02 出处:网络
I want to populate a preferences table when a user is created. I can make a lash up version within the controller easily enough but would like something neater.

I want to populate a preferences table when a user is created. I can make a lash up version within the controller easily enough but would like something neater.

Can on开发者_开发技巧e do the same sort of thing with fixtures within a running application? If so how?


You could search for a gem. I've used https://github.com/FooBarWidget/default_value_for some time ago for a similar thing. It's a nice and clean solution.


In the end I simple defined an array in the model and array.each -ed it. Not perhaps the most elegant but still have all the values in one place for editing.

0

精彩评论

暂无评论...
验证码 换一张
取 消