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.19 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.18 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.17 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.16 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.15 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.14 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.13 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.12 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.11 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.10 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.9 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.8 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.7 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.6 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.5 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.4 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.3 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.2 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0.1 db/seeds/55_fill_prop_names.rb.example
c80_estate-0.1.0 db/seeds/55_fill_prop_names.rb.example