I'm developing it at Ruby on Rails.
I use Fakergem to put test data in DB(mysql).
https://github.com/stympy/faker I was able to put in most of the data, but there are some things that I can't do with this.
Please tell me how I can resolve the above issues!
ruby-on-rails mysql rubygems
If I were to make test data, it would be like this.
(I don't know what kind of code Kim is writing, so I'm writing it in my imagination.)
schedule=Schedule.new
# 1. True/false settings do not use Faker
schedule.repeat=true#false can also be used
# 2. String only hours, minutes, and seconds from random date (e.g., "07:31:51")
schedule.scheduled_time=Faker::Time.between(DateTime.now-1, DateTime.now).strftime("%H:%M:%S")
# 3. Randomly set large or small
schedule.room=%w(large small).sample
schedule.save!
If it's a case like the question, I don't think I need to force myself to use Faker.
© 2024 OneMinuteCode. All rights reserved.