Module: ActiveRecordContentBlob::Blobable

Extended by:
ActiveSupport::Concern
Defined in:
lib/content_blob/blobable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#build_a_blob(some_content) ⇒ Object

instance methods

First, see if blob exists



63
64
65
66
67
68
69
70
71
# File 'lib/content_blob/blobable.rb', line 63

def build_a_blob(some_content)
  if has_blob?
    self.content_blob.assign_attributes(contents: some_content)
  else
    self.build_content_blob(contents: some_content)
  end

  self.content_blob
end

#has_blob?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/content_blob/blobable.rb', line 75

def has_blob?
  !content_blob.nil?
end