Module: GraphQLIncludable::ClassMethods
- Defined in:
- lib/graphql_includable.rb
Instance Method Summary collapse
-
#delegate(*methods, args) ⇒ Object
hook ActiveSupport’s delegate method to track models and where their delegated methods go.
- #delegate_cache ⇒ Object
- #includes_from_graphql(query_context) ⇒ Object
Instance Method Details
#delegate(*methods, args) ⇒ Object
hook ActiveSupport’s delegate method to track models and where their delegated methods go
20 21 22 23 24 25 |
# File 'lib/graphql_includable.rb', line 20 def delegate(*methods, args) methods.each do |method| delegate_cache[method] = args[:to] end super(*methods, args) if defined?(super) end |
#delegate_cache ⇒ Object
15 16 17 |
# File 'lib/graphql_includable.rb', line 15 def delegate_cache @delegate_cache ||= {} end |
#includes_from_graphql(query_context) ⇒ Object
10 11 12 13 |
# File 'lib/graphql_includable.rb', line 10 def includes_from_graphql(query_context) generated_includes = GraphQLIncludable.generate_includes_from_graphql(query_context, self.model_name.to_s) includes(generated_includes) end |