Module: InertiaRails::Controller::ClassMethods

Defined in:
lib/inertia_rails/controller.rb

Instance Method Summary collapse

Instance Method Details

#inertia_share(hash = nil, &block) ⇒ Object



31
32
33
34
35
36
# File 'lib/inertia_rails/controller.rb', line 31

def inertia_share(hash = nil, &block)
  before_action do
    @_inertia_shared_plain_data = @_inertia_shared_plain_data.merge(hash) if hash
    @_inertia_shared_blocks = @_inertia_shared_blocks + [block] if block_given?
  end
end

#use_inertia_instance_propsObject



38
39
40
41
42
43
# File 'lib/inertia_rails/controller.rb', line 38

def use_inertia_instance_props
  before_action do
    @_inertia_instance_props = true
    @_inertia_skip_props = view_assigns.keys + ['_inertia_skip_props']
  end
end