Class: RailsAdminImageManager::Tag

Inherits:
ApplicationRecord show all
Defined in:
app/models/rails_admin_image_manager/tag.rb

Class Method Summary collapse

Class Method Details

.retrieve_or_create_tag(tag_string) ⇒ Object



32
33
34
35
36
37
38
39
# File 'app/models/rails_admin_image_manager/tag.rb', line 32

def self.retrieve_or_create_tag(tag_string)
  tag = RailsAdminImageManager::Tag.find_by({name: tag_string})
  if tag.present?
    return tag
  else
    return RailsAdminImageManager::Tag.new({name: tag_string})
  end
end