Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. Permission denied - /assets
  2.  
  3. has_attached_file :avatar,
  4. :url => "/avatars/:id?style=:style",
  5. :styles => { :large => "190x190#", :medium => "70x70#", :thumb => "106x106#" },
  6. :path => "/assets/rob/images/Users/:id/:style/:basename.:extension"
  7.  
  8. :path => "~/robotimus/dev_images/:id/:style/:basename.:extension"
  9.  
  10. def images_path
  11. Rails.env.production? ? "/assets/rob/images/Users/" : "~/robotimus/dev_images"
  12. end
  13.  
  14. :path => images_path + "/:id/:style/:basename.:extension"
  15.  
  16. # config/paperclip.yml
  17. common: &common
  18. :styles:
  19. :thumb: "50x50#"
  20. :small: "80x80#"
  21. :medium: "200x150#"
  22. :normal: "320x240#"
  23. :large: "800x600#"
  24. :default_url: "/images/default_image.png"
  25.  
  26.  
  27. development:
  28. <<: *common
  29.  
  30. production:
  31. <<: *common
  32. :storage: :s3
  33. :bucket: "your-bucket-name"
  34. :path: "/:some/:path/:id"
  35. :url: "s3_domain_url
  36.  
  37. test:
  38. <<: *common
  39.  
  40. # config/initializers/config.rb
  41. require 'ostruct'
  42.  
  43. def load_config_yaml(config_file)
  44. YAML.load(File.read(Rails.root.join('config', config_file)))[Rails.env]
  45. end
  46.  
  47. AppConfig = OpenStruct.new(load_config_yaml('application.yml'))
  48.  
  49. AppConfig.paperclip = load_config_yaml('paperclip.yml')
  50.  
  51. # app/models/image.rb
  52. class Image < ActiveRecord::Base
  53. has_attached_file :photo, AppConfig.paperclip
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement