简体   繁体   English

Ruby on Rails:没有数据库的灯具

[英]Ruby on Rails: Fixtures without Database

I'm working on a 2-phase RoR project where in the first phase we are going to have alot of static data and in the second phase this will be dynamic. 我正在研究一个两阶段的RoR项目,在第一阶段我们将有很多静态数据,在第二阶段,这将是动态的。 I'm fairly new to RoR and thought that for the first phase rather than have hard-coded arrays I could leverage fixtures for the first phase and then in the second we could just pull the curtains away and we have the first steps of putting the database in. 我对RoR很新,并且认为对于第一阶段而不是硬编码阵列我可以在第一阶段利用灯具然后在第二阶段我们可以拉开窗帘,我们已经迈出了第一步数据库。

My problem is I can't seem to find a way to use fixtures directly, that is in not using the fixtures to pre-populate a database. 我的问题是我似乎无法找到直接使用灯具的方法,即不使用灯具预先填充数据库。 I want to basically be able to call the models just like I would if there was data and it return the fixtures. 我想基本上能够像我有的那样调用模型,如果有数据并返回灯具。

I really appreciate your help! 我真的很感谢你的帮助!

factory_girl会为你工作吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM