Search code examples
ruby-on-railsconventions

Where to put files that will be read in a Rails app?


I'm developing a Rails application and within that application I developed a Rake task that will read entries from a file and store them into the DB. Producing the code was no problem, but I'd like to know, where do I place the file that is read? Is there a convention for that, if yes, what is it?

I know I could have used the seed.rb file but is it ok, by the standards, to load and read a file from there?

Thanks in advance!


Solution

  • Yes, put the data you wish to load in the db/seeds.rb file and to load it run rake db:seed. This is what this file was designed to do.