Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:26:47+00:00 2026-06-11T16:26:47+00:00

I’m collaborating on an app and I occasionally run into trouble stemming from the

  • 0

I’m collaborating on an app and I occasionally run into trouble stemming from the fact that the original developer was working in linux and I’m in OSX. My current problem has to do with uploading images using ImageMagik and paperclip. When I try to upload a pic to the app, I get the following message.

Permission denied - /assets

I’m pretty sure this means that the app wanted to save the image somewhere in the assets directory but couldn’t because it doesn’t exist on my machine.

In the model, this is the code that addresses pics.

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"

Now, I’m assuming this directory exists on the original programmer’s computer and wherever the site is hosted at. But I don’t have that directory, so I did this:

  :path => "~/robotimus/dev_images/:id/:style/:basename.:extension"

But now I’m in a pickle since I’ll ultimately have to revert that line before I deploy. As a solution, I could write a method like this.

def images_path
  Rails.env.production? ? "/assets/rob/images/Users/" : "~/robotimus/dev_images"
end

And then the :path line would look like this:

  :path => images_path + "/:id/:style/:basename.:extension"

Does this sound like a good idea? Also, where should this method be stored? My guess is that it belongs in config/environment.rb, but I’d like to get an expert’s opinion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:26:49+00:00Added an answer on June 11, 2026 at 4:26 pm

    I did a similar thing for a project a while back, where in development I stored the images locally, but in the production environment, they were stored on Amazon S3.

    What I did was that I created a config/paperclip.yml.

    # 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
    

    Then I loaded that file into my app configuration:

    # 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')
    

    Then I just provided the has_attached_file call with AppConfig.paperclip.

    # app/models/image.rb
    class Image < ActiveRecord::Base
      has_attached_file :photo, AppConfig.paperclip
    end
    

    So if you want to store files in a different path (but still locally), just don’t use the s3-stuff.

    You can of course skip most of the config stuff and just set the image path in a config somewhere, if you don’t want to go all-in on this idea, but I like having configs separate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.