Module: GeneratedImagesHelper

Defined in:
app/helpers/generated_images_helper.rb

Instance Method Summary collapse

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.

Parameters:

Returns:

  • (String, nil)


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.author_name.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.

Parameters:

Returns:

  • (Array<String>)


9
10
11
12
13
14
# File 'app/helpers/generated_images_helper.rb', line 9

def source_record_tags(record)
  case record
  when ReviewsIo then ['review-avatar']
  else []
  end
end