ruby on rails - Item in Active Record that gets created by default on rake db:create -
or along lines. have belongs_to relationship, want have belongs_to relationship default 'unknown entity' type of item. make reporting on items don't belong easy, , won't have force creation of entity belongs on creation of item, things that. best way this? want item automatically created when database created or when migrations run. can put migration somehow?
i found answer in sidebar related question.
i use db:seed option, execute in seeds.rb file. more info can found here similar question.
http://codedecoder.wordpress.com/2013/04/25/rake-db-seed-in-rails/
Comments
Post a Comment