Sha256: 85cfb600ad2b6cb99d089a9421533079134661c43ca8e077d1cf62cdbc1889ff

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

module Recurso
  class Global
    # no-op methods to support being a Recurso::Resource
    define_singleton_method :has_one, ->(*args) {}
    define_singleton_method :has_many, ->(*args) {}
    define_singleton_method :belongs_to, ->(*args) {}

    include Singleton
    include Recurso::Resource

    def permission_policy
      OpenStruct.new(policy_type: :open)
    end

    def method_missing(method)
      super unless Recurso::Config.instance.global_relations.include?(method)

      method.to_s.classify.constantize.all
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
recurso-0.6.1 lib/recurso/models/global.rb