Sha256: 4124f1624e95625383df191ca3dc157bed36e1c817bc97d263b2baa22e701164

Contents?: true

Size: 646 Bytes

Versions: 16

Compression:

Stored size: 646 Bytes

Contents

module PaidUp::Mixins
  module PaidFor
    extend ActiveSupport::Concern
    class_methods do
      def paid_for
        feature = PaidUp::Feature.find_by_slug(table_name)
        if feature.nil?
          raise :feature_not_found_feature.l feature: table_name
        else
          case feature.setting_type
            when 'boolean'
              # Nothing needs doing
            when 'rolify_rows'
              resourcify
            when 'table_rows'
              belongs_to :user
            else
              raise :value_is_not_a_valid_setting_type.l(value: feature.setting_type)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
paid_up-0.6.5 lib/paid_up/mixins/paid_for.rb
paid_up-0.6.4 lib/paid_up/mixins/paid_for.rb
paid_up-0.6.3 lib/paid_up/mixins/paid_for.rb
paid_up-0.6.2 lib/paid_up/mixins/paid_for.rb
paid_up-0.6.1 lib/paid_up/mixins/paid_for.rb
paid_up-0.6.0 lib/paid_up/mixins/paid_for.rb
paid_up-0.5.3 lib/paid_up/mixins/paid_for.rb
paid_up-0.5.2 lib/paid_up/mixins/paid_for.rb
paid_up-0.5.1 lib/paid_up/mixins/paid_for.rb
paid_up-0.5.0 lib/paid_up/mixins/paid_for.rb
paid_up-0.4.4 lib/paid_up/mixins/paid_for.rb
paid_up-0.4.3 lib/paid_up/mixins/paid_for.rb
paid_up-0.4.2 lib/paid_up/mixins/paid_for.rb
paid_up-0.4.1 lib/paid_up/mixins/paid_for.rb
paid_up-0.4.0 lib/paid_up/mixins/paid_for.rb
paid_up-0.3.0 lib/paid_up/mixins/paid_for.rb