Class: Eventsimple::EntitiesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Eventsimple::EntitiesController
- Defined in:
- app/controllers/eventsimple/entities_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#event_class_names, #event_classes
Instance Method Details
#show ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/eventsimple/entities_controller.rb', line 5 def show @model_name = params[:model_name] @model_class = event_classes.find { |d| d.name == @model_name } @aggregate_id = params[:id] @event_id = params[:e] || -1 @tab_id = params[:t] == 'event' ? 'event' : 'entity' filter_columns = @model_class._filter_attributes params_filters = params.permit(filters: filter_columns).fetch(:filters, {}) @filters = filter_columns.index_with { |column| params_filters[column] } primary_key = @model_class.event_class._aggregate_id @entity = @model_class.unscoped.find_by!(primary_key => @aggregate_id) @entity_event_history = @entity.events.reverse @selected_event = @entity_event_history.find { |e| e.id == @event_id.to_i } || @entity_event_history.first previous_index = @entity_event_history.find_index { |e| e.id == @selected_event.id } + 1 @previous_event = @entity_event_history[previous_index] # Check projection mismatch BEFORE calling changes (which modifies @entity via reproject) @projection_mismatch = !@entity.projection_matches_events? @projection_diff = projection_diff if @projection_mismatch @entity_changes = changes rescue StandardError => e @error_message = e. render html: '', layout: true end |