RailsCasts Pro episodes are now free!

Learn more or hide this

iloveror's Profile

GitHub User: iloveror

Comments by

Avatar

who can help me?

class Attachment < ActiveRecord::Base
has_attached_file :att,
:url => "/files/:class/:id/:style/:basename.:extension",
:path => ":rails_root/public/files/systems/:id/:style/:basename.:extension"
end

class UserLogo < Attachment
has_one :user
has_attached_file :att,
:styles => { :original => "100x100>" } ,
:url => "/files/:class/:id/:style/:basename.:extension",
:path => ":rails_root/public/files/user_logos/:id/:style/:basename.:extension"

validates_attachment_content_type :att,
:content_type => ['image/png','image/jpg','image/bmp','image/jpeg','x-png','pjpeg']
end