Module: Lyra::Interceptors::CrudInterceptor

Extended by:
ActiveSupport::Concern
Defined in:
lib/lyra/interceptors/crud_interceptor.rb

Instance Method Summary collapse

Instance Method Details

#_delete_row ⇒ Object

Override _delete_row to skip SQL DELETE in event_sourcing mode. Similar to _update_row, runs after before_destroy callbacks.



47
48
49
50
51
52
53
54
55
# File 'lib/lyra/interceptors/crud_interceptor.rb', line 47

def _delete_row
  if @lyra_skip_sql
    # Skip the DELETE - projection will handle it
    # Return 1 to indicate one row was "deleted"
    1
  else
    super
  end
end

#_update_row ⇒ Object

Override _update_row to skip SQL UPDATE in event_sourcing mode. Rails 6.1+ calls _update_row from within _run_update_callbacks, so this runs AFTER before_update callbacks when @lyra_skip_sql is set.



35
36
37
38
39
40
41
42
43
# File 'lib/lyra/interceptors/crud_interceptor.rb', line 35

def _update_row(*)
  if @lyra_skip_sql
    # Skip the UPDATE - projection will handle it
    # Return 1 to indicate one row was "updated"
    1
  else
    super
  end
end