Sha256: e08fcd78c9b8006bcd0e96ef71f272fc85b4aeb65a3af2a527fd580683da9f31

Contents?: true

Size: 716 Bytes

Versions: 5

Compression:

Stored size: 716 Bytes

Contents

module Pwb
  class Feature < ApplicationRecord
    belongs_to :property

    belongs_to :feature_field_key, 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

5 entries across 5 versions & 1 rubygems

Version Path
pwb-1.1.1 app/models/pwb/feature.rb
pwb-1.0.0 app/models/pwb/feature.rb
pwb-0.1.1 app/models/pwb/feature.rb
pwb-0.1.0 app/models/pwb/feature.rb
pwb-0.0.2 app/models/pwb/feature.rb