Module: Graphiti::Rails
- Defined in:
- lib/graphiti/rails.rb
Overview
Rails Integration. Mix this in to ApplicationController.
-
Mixes in Base
-
Adds a global around_action (see Base#wrap_context)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/graphiti/rails.rb', line 10 def self.included(klass) backtrace = ::Rails::VERSION::MAJOR == 4 ? caller(2) : caller_locations(2) Graphiti::DEPRECATOR.deprecation_warning("Including Graphiti::Rails", "Use graphiti-rails instead. See https://www.graphiti.dev/guides/graphiti-rails-migration for details.", backtrace) klass.class_eval do include Graphiti::Context include GraphitiErrors around_action :wrap_context around_action :debug end end |
Instance Method Details
#debug ⇒ Object
28 29 30 31 32 |
# File 'lib/graphiti/rails.rb', line 28 def debug Debugger.debug do yield end end |
#jsonapi_context ⇒ Object
34 35 36 |
# File 'lib/graphiti/rails.rb', line 34 def jsonapi_context self end |
#wrap_context ⇒ Object
22 23 24 25 26 |
# File 'lib/graphiti/rails.rb', line 22 def wrap_context Graphiti.with_context(jsonapi_context, action_name.to_sym) do yield end end |