Sha256: e1b20513092960edbac197585247a33def912cdc48174f06f61d1f2e3d3bdb2f

Contents?: true

Size: 1.64 KB

Versions: 23

Compression:

Stored size: 1.64 KB

Contents

module C80Yax
  class PrefixProp < ActiveRecord::Base
    belongs_to :strsubcat
    has_and_belongs_to_many :prop_names

    include C80Yax::Concerns::Props::Parsable

    # +--------------+----------------+--------------+--------------------------------------------------------+---------------+
    # | strsubcat_id | prefix_prop_id | prop_name_id | title                                                  | uom_title     |
    # +--------------+----------------+--------------+--------------------------------------------------------+---------------+
    # |            7 |              5 |           36 | Бренд                                                  | NULL          |
    # |            7 |              6 |           46 | Завод                                                  | NULL          |
    # +--------------+----------------+--------------+--------------------------------------------------------+---------------+

    def self.select_props_sql(strsubcat_id)
      sql = "
      SELECT
        c80_yax_prefix_props.strsubcat_id,
        c80_yax_prefix_props_prop_names.*,
        c80_yax_prop_names.title,
        c80_yax_uoms.title as uom_title
      FROM c80_yax_prefix_props
        LEFT JOIN c80_yax_prefix_props_prop_names ON c80_yax_prefix_props.id = c80_yax_prefix_props_prop_names.prefix_prop_id
        LEFT JOIN c80_yax_prop_names ON c80_yax_prefix_props_prop_names.prop_name_id = c80_yax_prop_names.id
        LEFT JOIN c80_yax_uoms ON c80_yax_prop_names.uom_id = c80_yax_uoms.id
      WHERE c80_yax_prefix_props.strsubcat_id = #{strsubcat_id};
    "
      rows = ActiveRecord::Base.connection.execute(sql)
      rows

    end

  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
c80_yax-0.1.0.25 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.24 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.23 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.22 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.21 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.20 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.18 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.17 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.16 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.15 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.14 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.13 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.12 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.11 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.10 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.9 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.8 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.7 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.6 app/models/c80_yax/prefix_prop.rb
c80_yax-0.1.0.5 app/models/c80_yax/prefix_prop.rb