Module: GeneratedImagesHelper
- Defined in:
- app/helpers/generated_images_helper.rb
Instance Method Summary collapse
-
#source_record_suggested_title(record) ⇒ String?
Returns a sensible default title for the imported image based on the source record.
-
#source_record_tags(record) ⇒ Array<String>
Returns the tags that should be pre-selected on import for a given source record.
Instance Method Details
#source_record_suggested_title(record) ⇒ String?
Returns a sensible default title for the imported image based on the source record.
Returns nil when no source record is present, allowing the caller to fall back.
21 22 23 24 25 26 |
# File 'app/helpers/generated_images_helper.rb', line 21 def source_record_suggested_title(record) case record when ReviewsIo "Avatar — #{record..presence || 'Review'} ##{record.id}" end end |
#source_record_tags(record) ⇒ Array<String>
Returns the tags that should be pre-selected on import for a given source record.
Add a new when clause as new source record types are supported.
9 10 11 12 13 14 |
# File 'app/helpers/generated_images_helper.rb', line 9 def (record) case record when ReviewsIo then ['review-avatar'] else [] end end |