Sha256: 76f9ee82b694549ef6ccb345daade6a252de6c751efae628ee5d05d597c5e187

Contents?: true

Size: 1.09 KB

Versions: 40

Compression:

Stored size: 1.09 KB

Contents

# rake db:seed:55_fill_prop_names

C80Estate::PropName.delete_all

arr = [
    {
        prop_name: {
            id: 1,
            title: 'Цена за м.кв.',
            is_normal_price: true,
            is_excluded_from_filtering: true
        },
        uom: 'руб'
    },
    {
        prop_name: {
            id: 2,
            title: 'Высота потолков',
            is_normal_price: false,
            is_excluded_from_filtering: false
        },
        uom: 'м'
    },
    {
        prop_name: {
            id: 3,
            title: 'Шаг колонн',
            is_normal_price: false,
            is_excluded_from_filtering: false
        },
        uom: 'м'
    },
    {
        prop_name: {
            id: 4,
            title: 'Тип ворот',
            is_normal_price: false,
            is_excluded_from_filtering: false
        }
    }
]

arr.each do |elem|
    p = C80Estate::PropName.create!(elem[:prop_name])
    if elem[:uom].present?
        u = C80Estate::Uom.where(:title => elem[:uom]).first
        u.prop_names << p
        u.save
    end
    p.save
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
c80_estate-0.1.0.39 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.38 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.37 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.36 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.35 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.34 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.33 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.32 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.31 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.30 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.29 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.28 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.27 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.26 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.25 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.24 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.23 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.22 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.21 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.20 db/seeds/55_fill_prop_names.rb.example