<commit_before>require 'active_support/concern'

module Spree
  class Payment < ActiveRecord::Base
    module LoyaltyPoints
      extend ActiveSupport::Concern

        module ClassMethods

          def any_with_loyalty_points?
            by_loyalty_points.size != 0
          end

          #TODO -> We can create scope for this.
          def by_loyalty_points
            joins(:payment_method).where(:spree_payment_methods => { type: 'Spree::PaymentMethod::LoyaltyPoints'})
          end

        end

      private
<commit_msg>Added readonly(false) to avoid ActiveRecord::ReadOnlyRecord error<commit_after>require 'active_support/concern'

module Spree
  class Payment < ActiveRecord::Base
    module LoyaltyPoints
      extend ActiveSupport::Concern

        module ClassMethods

          def any_with_loyalty_points?
            by_loyalty_points.size != 0
          end

          #TODO -> We can create scope for this.
          def by_loyalty_points
            joins(:payment_method).readonly(false).where(:spree_payment_methods => { type: 'Spree::PaymentMethod::LoyaltyPoints'})
          end

        end

      private

{'fraction_non_alphanumeric': 0.07130281690140845, 'fraction_numerical': 0.0017605633802816902, 'mean_word_length': 2.542056074766355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5006430', 'n_tokens_mistral': 326, 'n_tokens_neox': 311, 'n_words': 71}