Sha256: b7b0775530e180ffcaa3d2ac9598cbed0821f831a407a70b9b54b72cd2b014d6

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

module NotificationSettings
    module NotificationScopes

        extend ActiveSupport::Concern

        included do
            include NotificationSettings::NotificationScopes::InstanceMethods
        end

        module InstanceMethods

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

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

        end

    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notification-settings-1.0.0.beta10 lib/notification_settings/notification_scopes.rb
notification-settings-1.0.0.beta9 lib/notification_settings/notification_scopes.rb