Module: InertiaRails::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/inertia_rails/controller.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #default_render ⇒ Object
- #inertia_headers ⇒ Object
- #inertia_headers=(value) ⇒ Object
- #inertia_view_assigns ⇒ Object
- #redirect_back(fallback_location:, allow_other_host: true, **options) ⇒ Object
- #redirect_to(options = {}, response_options = {}) ⇒ Object
- #shared_data ⇒ Object
Instance Method Details
#default_render ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/inertia_rails/controller.rb', line 54 def default_render if InertiaRails.default_render? render(inertia: true) else super end end |
#inertia_headers ⇒ Object
46 47 48 |
# File 'lib/inertia_rails/controller.rb', line 46 def inertia_headers @_inertia_html_headers.join.html_safe end |
#inertia_headers=(value) ⇒ Object
50 51 52 |
# File 'lib/inertia_rails/controller.rb', line 50 def inertia_headers=(value) @_inertia_html_headers = value end |
#inertia_view_assigns ⇒ Object
80 81 82 83 |
# File 'lib/inertia_rails/controller.rb', line 80 def inertia_view_assigns return {} unless @_inertia_instance_props view_assigns.except(*@_inertia_skip_props) end |
#redirect_back(fallback_location:, allow_other_host: true, **options) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/inertia_rails/controller.rb', line 71 def redirect_back(fallback_location:, allow_other_host: true, **) capture_inertia_errors() super( fallback_location: fallback_location, allow_other_host: allow_other_host, **, ) end |
#redirect_to(options = {}, response_options = {}) ⇒ Object
66 67 68 69 |
# File 'lib/inertia_rails/controller.rb', line 66 def redirect_to( = {}, = {}) capture_inertia_errors() super(, ) end |
#shared_data ⇒ Object
62 63 64 |
# File 'lib/inertia_rails/controller.rb', line 62 def shared_data (@_inertia_shared_plain_data || {}).merge(evaluated_blocks) end |