Sha256: a83634380d451f7e5ccee1af1cb371f28865d2fa07cdc61a0a80a82d7c1faba6

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

require 'notification-handler'
require 'active_support'

module NotificationSettings
  module NotificationScopes
    extend ActiveSupport::Concern

    module ClassMethods
      def method_missing(method, *args)
        if method.to_s[/(.+)_category/]
          where(category: $1.singularize.classify)
        else
          super
        end
      end

      def respond_to_missing?(method, include_private = false)
        super || method.to_s[/(.+)_category/]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notification-settings-3.0.2 lib/notification_settings/notification_scopes.rb
notification-settings-2.0.0 lib/notification_settings/notification_scopes.rb