Title / Description
Code namespace :db do desc "Erase and fill database" task :populate => :environment do [Product].each(&:delete_all) Product.populate 10..100 do |product| product.title = Populator.words(1..5).titleize product.description = Populator.sentences(2..10) product.price = [4.99, 19.95, 100] end end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code