Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Permission denied - /assets
- has_attached_file :avatar,
- :url => "/avatars/:id?style=:style",
- :styles => { :large => "190x190#", :medium => "70x70#", :thumb => "106x106#" },
- :path => "/assets/rob/images/Users/:id/:style/:basename.:extension"
- :path => "~/robotimus/dev_images/:id/:style/:basename.:extension"
- def images_path
- Rails.env.production? ? "/assets/rob/images/Users/" : "~/robotimus/dev_images"
- end
- :path => images_path + "/:id/:style/:basename.:extension"
- # config/paperclip.yml
- common: &common
- :styles:
- :thumb: "50x50#"
- :small: "80x80#"
- :medium: "200x150#"
- :normal: "320x240#"
- :large: "800x600#"
- :default_url: "/images/default_image.png"
- development:
- <<: *common
- production:
- <<: *common
- :storage: :s3
- :bucket: "your-bucket-name"
- :path: "/:some/:path/:id"
- :url: "s3_domain_url
- test:
- <<: *common
- # config/initializers/config.rb
- require 'ostruct'
- def load_config_yaml(config_file)
- YAML.load(File.read(Rails.root.join('config', config_file)))[Rails.env]
- end
- AppConfig = OpenStruct.new(load_config_yaml('application.yml'))
- AppConfig.paperclip = load_config_yaml('paperclip.yml')
- # app/models/image.rb
- class Image < ActiveRecord::Base
- has_attached_file :photo, AppConfig.paperclip
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement