When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...

If you need to find all files inside a directory that were modified in the last 24 hours you can...

In modern Rails versions you can also use ActiveRecord's pluck method. User.active.pluck(:id) => [1, 5, 23, 42]

First of all: You could just use RVM which would make the pain go away. If for some reason you...

makandra dev

sudo apt-get install i8kutils Reboot You can now run the i8k tools such as i8kmon Setting the fan speed...

makandra dev

Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.

Sometimes you want to fetch associations for an ActiveRecord that you already loaded, e.g. when it has deeply nested associations...

When deploying Rails applications you might have noticed that JS and CSS are not cached by all browsers.

github.com

Boolean attributes can now be set by appending "which", "that" or "who" at the end: Given there is a movie...

popthis is awesome when used with inaction_mailer. Setup inaction_mailer Install the gem: sudo gem install popthis

So you screwed up and copied Paperclip secrets from one project to another. Here is a semi-automatic, painful way...

stackoverflow.com

Reverting a commit means creating a new commit that undoes the old changes. Imagine the following commit history:

When doing a query like this: SELECT id FROM users WHERE (users.id IN (899,1084,1095,100,2424,2429,2420...

When you get this while installing the raspell gem: ERROR: Error installing raspell: ERROR: Failed to build gem native extension...

When you get this error: No word lists can be found for the language "de". An aspell dictionary is missing...

makandra dev

This may be awkward to set up, but will work once you're done. Fun facts:

Unless all MySQL server defaults are set to UTF-8, mysqldump encodes UTF-8 characters incorrectly and only outputs correct...

morris-photographics.com

Some browsers render PNG images with color profiles and other shenanigans, some don't. The cleanest way to have consistent...

Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat...

Until May 2011 our gems have been created with Jeweler, which is a helper library to package code into a...

makandra dev

rspec_spinner is a progress bar for RSpec which outputs failing examples as they happen (instead of all at the...

makandra dev

Install gem and plugin sudo gem install parallel script/plugin install git://github.com/grosser/parallel_tests.git Adapt config/database.yml test: database: xxx_test<%= ENV...

sudo gem install gettext --no-ri --no-rdoc sudo gem install fast_gettext --no-ri --no-rdoc script/plugin install git://...

install apache sudo apt-get install ruby1.8-dev sudo gem install passenger sudo passenger-install-apache2-module follow the instructions