Sha256: 605da431a1eb9894d7006f786bae8c0e1f7f26b0a5345332b37a9cd06581ca4e

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

module Pwb
  class Feature < ApplicationRecord
    belongs_to :property, optional: true

    belongs_to :feature_field_key, optional: true, class_name: :FieldKey, foreign_key: :feature_key, inverse_of: :features
    # above allows:
    # Property.first.features.count and
    # FieldKey.last.properties_count but most importantly
    # FieldKey.where(tag: "extras").where('properties_count > ?', 0)
    # above will get only extras that are in use - usefull for an improved searchbox

    # below should allow me to count how many properties have a given extra/feature
    # by setting properties_count on field_key
    # , :counter_cache => "properties_count"
    # counter_culture :feature_field_key, :column_name => "properties_count"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pwb-1.4.0 app/models/pwb/feature.rb
pwb-1.3.0 app/models/pwb/feature.rb
pwb-1.2.0 app/models/pwb/feature.rb