With the upgrade to RVM 1.19 you are asked to convert your old .rvmrc file into .ruby-version and .ruby-gemset files.
You are using ‘.rvmrc’, it requires trusting, it is slower and it is not compatible with other ruby managers, you can switch to ‘.ruby-version’ using ‘rvm rvmrc to [.]ruby-version’ or ignore this warnings with ‘rvm rvmrc warning ignore /Users/danielkehoe/code/railsapps/rails-prelaunch-signup/.rvmrc’, ‘.rvmrc’ will continue to be the default project file in RVM 1 and RVM 2, to ignore the warning for all files run ‘rvm rvmrc warning ignore all.rvmrcs’.
A typical .ruby-version file would contain
The .ruby-gemset file would have
You can add the gemset name into the .ruby-version file as
ruby-2.0.0-p0@MyProject but that breaks compatibility with other Ruby version launchers.
Pow needs RVM to be loaded and for it to select the correct Ruby version to run your app with. You do this with the .powrc file. Mine looks like this:
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ] ; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
That’s all there is to it!
Storm is a web development agency based in Bath, UK with a growing reputation. To meet our ever increasing demand we’re looking for some new talent to join our skilled team.
- Role: Web Developer
- Basis: Full time
- Salary: Based on experience
- Location: Storm HQ, Bath, UK
So you’ve setup carrierwave_direct and you’re happily uploading files to Amazon S3. In this example I’ve mounted CarrierWave on a field called csv_file, but that can be whatever is appropriate to your app.
You’ve probably got two controller methods
@model = Model.new
@uploader = @model.csv_file
@uploader.success_action_callback = upload_successful_model_url(@model)
@model = Model.find(params[:id])
# Now what??
You need to save the file name to the model so that it can be referenced later. The documentation (at the time of writing) offers no indication of how you might go about that. The secret is in the key attribute that CarrierWave adds to your model.
@model = Model.find(params[:id])
@model.key = params[:key]
Simple. When you know how!
We love Heroku. It makes deployment so easy and quick. However, it can start to get pricey when you add additional dynos at $35 each a month.
With a small amount of work, you can get a lot more out of your Heroku hosting whilst drastically improving the performance of your site. You might need to spend a little bit of cash on other services, but a lot less than if you simply moved the dyno slider up a few notches, and the result will be much better scalability.
So how do we max out the performance of our Heroku apps? First we stop using Heroku for things it’s bad at, then we let it do more of what it is good at, running your application code.
I’m playing around with Tomdoc for documenting my latest Rails project. The documentation is (ironically) a bit thin on the ground. It’s taking a bit of trial and error to get some things working. The most recent brainteaser was how to get tomdoc (or even rdoc) to document a scope declared on a Rails model.
I have an application where a lot of work gets done behind the scenes by worker processes, scripts and rake tasks. I have a sweeper for one of my models to clear out some caches that can’t be cleared automatically using DHH’s key-based expiration technique. The cache keys in this use case are simple strings.
No matter how good the documentation for a Ruby gem might be, from time to time you’ll probably need to dig around in the code to check or confirm exactly what it does, or what options it might take.
I recently ran into a bit of a gotcha concerning the way nested records get updated in Rails, which in hindsight makes total sense, but caused some confusion at the time.
I’ve been using the rather excellent PDFKit library on a recent Ruby on Rails project to generate PDF reports. The API is perfect: have some HTML, give me a PDF back.
I’ve just deployed a Ruby on Rails application in a sub-directory of a client’s website. So rather than accessing the app at www.example.com, you need to visit www.example.com/app. This was quite easy using an extra couple of lines in config.ru.