Images in rails 3.1 - moving to production

前端 未结 1 1028
自闭症患者
自闭症患者 2021-01-07 11:53

My articles have images. I put the images in app/assests/images and store their location in a field in the database.

Then I can display them in by using:

         


        
1条回答
  •  伪装坚强ぢ
    2021-01-07 12:29

    This is a problem I ran into when Rails 3.1 was released.

    Normal assets

    If your assets are manually placed by you then all you have to do is run:

    rake assets:precompile
    

    This will precompile your assets into public/assets.

    It's best to precompile on your production server so you don't have unessential files on your development server.

    Uploaded assets

    If you are uploading images using something like Paperclip, then don't use the asset folder.

    You need put your images in the public folder. In your case probably public/assets/articles

    Further Info

    • RailsGuides - Asset Pipeline

    0 讨论(0)
提交回复
热议问题