开发者

Rails fixtures or similar for creating data within an app

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜