Jump to content

The ultimate community for Ruby on Rails developers.


Photo

How to do seed files per environment?


  • Please log in to reply
2 replies to this topic

#1 darrenl

darrenl

    Passenger

  • Members
  • 3 posts

Posted 09 November 2013 - 10:24 PM

Hi all, I notice there is only one seeds.rb file. Is it possible to have only a seeds file (fixtures) for the development environment? I would like to be able to create data specifically for development, is this possible or have I just not seen or become aware of how to do this yet?

 

Thanks,
Darren



#2 Adam

Adam

    Inspector

  • Administrators
  • 71 posts

Posted 10 November 2013 - 01:56 PM   Best Answer

Seeds are really just designed for development. However: you can just add something like this to your seeds.rb and then create seeds.production.rb or seeds.development.rb for whatever you need.

require Rails.root.join("db", "seeds.#{Rails.env}")

Adam Cooke

from aTech Media - UK-based Ruby on Rails developers. 

 

Follow me on Twitter  •  Check out my code on GitHub  •  Take a look at my designs


#3 darrenl

darrenl

    Passenger

  • Members
  • 3 posts

Posted 13 November 2013 - 07:27 PM

Thanks, thats what I needed, although it does make sense in regards to production. 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users