You’re not receiving notifications from this thread.
Some good ways of seeding data in my app?
I need some seed data for my app. How do I seed Devise users, and always as images for Paperclip?
I'd probably toss everything in db/seeds.rb. Check out the ffaker gem for creating fake names and things.
If you need to create Devise users, you can just do this (but you'll have to give them passwords)
# You can optionally generate a password if you don't want to hardcode the password # generated_password = Devise.friendly_token.first(8) User.create(email: "email@example.com", password: "password", password_confirmation: "password")
And for paperclip images, you can use the ruby File library to open the file and assign it.
img = File.open(File.join(Rails.root, 'image.png')) User.first.update(avatar: img)
You can use Rails.root there as a helper to get the Rails directory, and then you can join in any folders and filenames you need to get the full path in Ruby. Then you open it as a File object and assign that to your paperclip attribute. That should do the trick!