Module: AbAdmin::Concerns::Fileuploads::InstanceMethods

Defined in:
lib/ab_admin/concerns/fileuploads.rb

Instance Method Summary collapse

Instance Method Details

#fileupload_asset(method) ⇒ Object

Find or build new asset object


79
80
81
82
83
84
85
# File 'lib/ab_admin/concerns/fileuploads.rb', line 79

def fileupload_asset(method)
  if fileuploads_columns.include?(method.to_sym)
    asset = new_record? ? self.class.fileupload_find(method, fileupload_guid) : send(method)
    asset ||= send("build_#{method}") if respond_to?("build_#{method}")
    asset
  end
end

#fileupload_changed?Boolean

Returns:

  • (Boolean)

70
71
72
# File 'lib/ab_admin/concerns/fileuploads.rb', line 70

def fileupload_changed?
  @fileupload_changed === true
end

#fileupload_guidObject


61
62
63
# File 'lib/ab_admin/concerns/fileuploads.rb', line 61

def fileupload_guid
  @fileupload_guid ||= AbAdmin.friendly_token
end

#fileupload_guid=(value) ⇒ Object


65
66
67
68
# File 'lib/ab_admin/concerns/fileuploads.rb', line 65

def fileupload_guid=(value)
  @fileupload_changed = true unless value.blank?
  @fileupload_guid = value.blank? ? nil : value
end

#fileupload_multiple?(method) ⇒ Boolean

Returns:

  • (Boolean)

74
75
76
# File 'lib/ab_admin/concerns/fileuploads.rb', line 74

def fileupload_multiple?(method)
  self.class.fileupload_multiple?(method)
end

#fileuploads_columnsObject


87
88
89
# File 'lib/ab_admin/concerns/fileuploads.rb', line 87

def fileuploads_columns
  self.class.fileuploads_columns
end