Class: Trailblazer::Finder::Activities::PrepareEntity
- Inherits:
-
Activity::Railway
- Object
- Activity::Railway
- Trailblazer::Finder::Activities::PrepareEntity
- Defined in:
- lib/trailblazer/finder/activities/prepare_entity.rb
Instance Method Summary collapse
- #invalid_entity_error(ctx) ⇒ Object
- #set_entity(ctx, config:) ⇒ Object
- #validate_entity(ctx, config:) ⇒ Object
Instance Method Details
#invalid_entity_error(ctx) ⇒ Object
11 12 13 |
# File 'lib/trailblazer/finder/activities/prepare_entity.rb', line 11 def invalid_entity_error(ctx, **) (ctx[:errors] ||= []) << {entity: "Invalid entity specified"} end |
#set_entity(ctx, config:) ⇒ Object
15 16 17 |
# File 'lib/trailblazer/finder/activities/prepare_entity.rb', line 15 def set_entity(ctx, config:, **) ctx[:entity] = ctx.dig(:options, :entity) || instance_eval(&config.entity) end |
#validate_entity(ctx, config:) ⇒ Object
7 8 9 |
# File 'lib/trailblazer/finder/activities/prepare_entity.rb', line 7 def validate_entity(ctx, config:, **) ctx.dig(:options, :entity) || config.entity end |