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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -