db/seed.rb in stockor-0.1.5 vs db/seed.rb in stockor-0.1.7

- old
+ new

@@ -3,11 +3,15 @@ require_relative '../lib/skr' module Skr - user = Lanes::User.where(login: 'admin').first! + user = Lanes::User.where(login: 'admin').first + if user.nil? + user = Lanes::User.new(name: "Admin", email: "admin@test.com", + login: 'admin', role_names: ['admin']) + end Lanes::User.scoped_to(user) do seeds_path = Pathname.new(__FILE__).dirname.join('seed') unless Location.default Location.create( code: Skr.config.default_location_code, name: "System default", @@ -20,10 +24,8 @@ end YAML::load( seeds_path.join('payment_terms.yml').read ).each do | acct_data | PaymentTerm.where(code: acct_data['code'].to_s).any? || PaymentTerm.create!(acct_data) end - - end end