I need to configure my carrierwave gem in rails to use a different upload folder beyond the whole rails scope.
I have a VPS and using RVM, ruby, rails. I'm deploying with capistrano, but every time a deploy takes place, the upload folder changes to the new deployed version and not taking all the older images with it.
I want to have a folder that is static and not going to be changed every deployment. But i cant seem to get the solid settings, the cache and store directories are being changed. Also when i'm using Rails.root (this gets me the current capistrano deployment folder) need to get 1 or 2 maps above this folder (way beyond the rails.root)
How could i change this settings so that this is going to work?
Thank you for your time
Update
Changed to full url : /home/deploy/rails_apps/site/uploads/ and its being uploaded. Only when i want to display the picture, this gives me a X mark. If i want to open the image by the firebug inspector, it gives me the error:
No route matches [GET] "/home/deploy/rails_apps/site/uploads/product/image/5/thumb_test.png"
How must i make a route that's beyond this application?
Are you using shared configs with symlinks with Capistrano on your VPS?
If so, you can make there a config for carrier wave picture folder which won't get overwritten. Than you can also use different setting on dev- and deployment machine.
You can take a look at this screencast: Capistrano Tasks from Ryan Bates
Hope it helps.
Related
I am new to rails so this is probably a simple question about using the asset pipeline.
In my app, I want to use this jquery plugin: http://www.fyneworks.com/jquery/star-rating/
So to do it, I included the following gem in my gemfile: https://github.com/RichGuk/jquery-star-rating-rails
However, I find that the image used for the star ratings is too low resolution and I'd also like to change the style. However, all 3 versions of the stars that are displayed are held in one image so I'd have to play around with the scripts as well to make sure they are configured properly if I make the image for the stars larger.
Back to my question: How do I edit this image file in my application?
I've tried downloading all the files and putting them in my vender directory and editing the file but it did not seem to work.
I know the files are included by the gem but how do make the files visible to edit?
Appreciate the help!
So the asset pipeline consists of potentially many directories (assuming you are using gems that inject their own assets into the pipeline). When an asset is being grabbed in Rails, Rails goes through these directories (in the same order, every time) to find the asset. When the name of the file is first found, that's it, Rails grabs it and uses that file.
Vendor asset directories are specified after app assets, I believe. So, if you place the image that you want to change in the app/assets/images folder, you'll essentially be overriding that vendor image in your application with your own image since Rails will search it's own app/assets first. Obviously, the files need to be named the same.
Try adding your star image in your assets path. It seem to
reference star.gif using the asset_path
I would also try
overriding the star plugin by creating your own css file.
I am trying to deploy my Rails 3.2 app to a subdirectory, /support, on an Apache server. Consulting the various posts, the only solutions that seem to have helped involve setting up a symbolic link on the server and changing css image references slightly (two dots '..' required before /assets in the css url references--I can't seem to find the post on that one now). I am getting success in deployment to production with Capistrano, but then strangely after awhile something changes, the /support reference breaks and the stylesheets don't load. Any suggestions?
oh no, please don't deploy rails as sub-uri in that way, you are making yourself in trouble.
So far as I see, ( according to this post: http://kb.site5.com/ruby-on-rails/how-to-deploy-a-rails-3-application-to-a-sub-directory/ ) you created soft links, modified your routes.rb, and changed RAILS.root in environment.rb, and also changed your assets files... all of these make your rails app messed up.
I suggest you use 'passenger' as rails server and checkout this post: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rack_to_sub_uri, it's quite easier and simplier
Am using EngineYard to host my Rails 3.2 app. This application allows users to post images/assets. I save them in the public directory (using Paperclip Gem). Now, my problem is that - with a new deployment, I am having to manually copy over the assets to the CURRENT version.
Though, I could use AmazonS3, I still want to figure out if there is a way in EngineYard which lets me save/serve the assets from a different directory than the code, say /data/assets.
Please, let me know if you see any other alternate implementations too.
Typically your structure would look like
/data
myapp/
shared/
images
releases/
20120613000000
20120601000000
...
current (symlink to one of the releases)
When you deploy, you symlink public/images to shared/images and so your images always get stored in a non release dependant location.
I would encourage you to use something like s3: you'll make things a lot easier for when you want to host the app on multiple instances.
I am trying to modify javascript files in a Ruby on Rails application in HEROKU. Every time I modified something, it did not have any effect on the application. Thanks to a member in this web site, I realized that my application is using asset packager. This asset packager creates a file called base_packaged.js that has all the javascript file compressed.
Because I am new with Heroku and using Windows I modify everything with a text editor, in this case I use notepad++. So when I change the file for example quote.js, nothing happens. I suppose The file quote.js is changed but the compressed base_packaged.js is not been updated. So when I push the file using GIT GUI to Heroku, only the file quote.js is updated but heroku does not recognized that change and does not modify the base_package.js.
How can I modify edit or update the base_package.js. Obviously file is very important I don't want to make a mess with my application.
Thank you.
Ok, so this is surely a suboptimal solution but I have had the same exact problem and this is what I have done. Go into any file such as your rake file in your public directory and just add something to a comment or add another comment.
Git will see this change and your other changes will get added along. I completely understand that this is a hack but It is super easy you works!
I am currently using rails 3.1.0.rc1 and when i deploy it to a server which is using passenger and it is deployed to a suburi.
But when I go into look at the site, path to the style-sheets and java-script files are not being included because of the path.
Can someone let me know how to specify the path in the environments so that all the assets (images , style-sheets and java-script ) point to the right path ?
This issue was fixed on Rails 3.1.0.rc4. You no need to specify anything for the config.assets.prefix unless you want the change the default /assets.
I got around it using YourApp::Application.config.assets.prefix = "/suburi/assets". Acording to issue #1489, helpers didn't respect this till last Tuesday, so you'll have to use 3.1rc4. Url's seem to get created correctly, so it may be more of a phusion problem.