Module: ActiveStorage::Blob::Identifiable

Included in:
ActiveStorage::Blob
Defined in:
activestorage/app/models/active_storage/blob/identifiable.rb

Instance Method Summary collapse

Instance Method Details

#identified?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'activestorage/app/models/active_storage/blob/identifiable.rb', line 16

def identified?
  identified
end

#identifyObject


4
5
6
7
# File 'activestorage/app/models/active_storage/blob/identifiable.rb', line 4

def identify
  identify_without_saving
  save!
end

#identify_without_savingObject


9
10
11
12
13
14
# File 'activestorage/app/models/active_storage/blob/identifiable.rb', line 9

def identify_without_saving
  unless identified?
    self.content_type = identify_content_type
    self.identified = true
  end
end