문제

I have a number of CSV formatted files I would like to use as Fixtures or Factory Girl data. I found this..

Rails won't find CSV fixtures

which states that CSV file support is deprecated. What other solutions do I have to use CSV files as sample data with rspec?

도움이 되었습니까?

해결책

Fixtures are very hard to maintain and almost everybody is migrating to Factories. I encourage you to consider creating some factories instead of relying on fixtures, also considering your fixtures are in a format no longer supported.

It may take a little bit more at the beginning, but the maintenance will definitely be more effective.

You can create a script to parse the CSV and feed the database with your fixtures, but again, I do not encourage you to do that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top