Module: TinySupport::ActiveRecord::HasAvatarAble::ClassMethods

Defined in:
lib/tiny_support/active_record/has_avatar_able.rb

Instance Method Summary collapse

Instance Method Details

#has_upload_avatar_able(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/tiny_support/active_record/has_avatar_able.rb', line 8

def has_upload_avatar_able *args
  options = args.extract_options!
  _filed_name = args.first || :avatar

  _options = ::TinySupport.config.upload_attachment_options.merge(options)
  _options[:url] ||= "/#{TinySupport.config.default_upload_prefix}/:class/:attachment/:id_partition/:style/:filename"

  self.has_attached_file _filed_name, _options
end