Sha256: ea64f82e205c4b52ef1b4da8393e2f19b80f8a01088309e13d59673516bbedd8

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

class AvatarFile < Models::BaseFile
  def build_path name, version = nil
    "#{rad.models.fs['prefix']}/avatars" + build_standard_path(model.name, version)
  end

  def build_url name, version = nil
    "#{rad.models.fs['host']}#{rad.models.fs['prefix']}/avatars" + build_standard_url(model.name, version)
  end

  version :icon do
    def process &block
      mini_magic block do |image|
        image.resize '50x50'
      end
    end
  end

  # interpolation = "/fs/avatars/:name/:filename_with_style"
  # interpolation = "/fs/:account/:space/files/:slug/:filename_with_style"
  # has_attached_file :avatar, styles: {icon: ["50x50#", :png]}, default_style: :icon,
  #   path: (":public_path" + interpolation),
  #   url: (config.url_root! + interpolation)
  #
  # validates_maximum_file_size :avatar
  #
  # def set_avatar_file_name
  #   if avatar and avatar.instance_read(:file_name) != "image.png"
  #     self.avatar.instance_write(:file_name, "image.png")
  #   end
  # end
  # protected :set_avatar_file_name
  # before_save :set_avatar_file_name
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rad_users-0.0.2 app/models/avatar_file.rb