Sha256: 491ed2fd3ca836717875b04156a76dd346cfe2ba4e69990d87e8bf6cda8bd754

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'pathname'
require 'yaml'
require_relative '../lib/skr'


module Skr
    user = Lanes::User.where(login: 'admin').first
    if user.nil?
        user = Lanes::User.create!(name: "Admin", email: "admin@test.com",
                                   password: 'senal', password_confirmation: 'senal',
                                   login: 'admin', role_names: ['administrator'])

    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",
              address: Address.new(name:"System default")
            )
        end

        YAML::load( seeds_path.join('chart_of_accounts.yml').read ).each do | acct_data |
            GlAccount.where(number: acct_data['number'].to_s).any? || GlAccount.create!(acct_data)
        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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stockor-0.1.8 db/seed.rb