Guest User

Untitled

a guest
Jul 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. class Asset < ActiveRecord::Base
  2. has_attached_file :data,
  3. styles: { large: "800x800>", medium: "300x300>", thumb: "80x80#" },
  4. storage: :s3,
  5. s3_credentials: AppConfig["s3_credentials"],
  6. path: "assets/:id/:style.:extension",
  7. bucket: AppConfig["s3_bucket"]
  8.  
  9. belongs_to :attachable, polymorphic: true
  10. belongs_to :owner, :class_name => 'User'
  11.  
  12. def url(*args)
  13. data.url(*args)
  14. end
  15.  
  16. def name
  17. data_file_name
  18. end
  19.  
  20. def content_type
  21. data_content_type
  22. end
  23.  
  24. def file_size
  25. data_file_size
  26. end
  27. end
Add Comment
Please, Sign In to add comment