This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...
To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet...
If you added a file by mistake, you can unstage it (but keep local changes) by saying git reset HEAD...
There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define
You may omit the /path/to/link_name to have a link with the same filename appear in the current directory
When deploying Rails applications you might have noticed that JS and CSS are not cached by all browsers.
When you roll custom URLs with hacks like routing-filter, you can put a spec like this into spec/routing/routing_spec.rb:
You can write regular expressions some different ways, e.g. /regex/ and %r{regex}. For examples, look here. Remember that it...
jamesgolick / resource_controller at Github module ResourceController module Actions def index load_collection before :index response_for :index end
So you screwed up and copied Paperclip secrets from one project to another. Here is a semi-automatic, painful way...
Capybara does not play nice with sites that have some actions protected by SSL, some not. A popular way to...
An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...
Ubuntu lets you mount an SSH shell into Nautilus from Places -> Connect to server (select "SSH" as server type).
The Rails router has been written and rewritten at least four times2, including a recent rewrite for the upcoming Rails...
Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a...
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...
Dir.glob(File.join RAILS_ROOT, 'app', 'models', '*.rb').collect{ |path| path[/.+\/(.+).rb/,1] }.collect(&:camelize).collect(&:constantize)
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat...
To parse XML-documents, I recommend the gem nokogiri. A few hints: xml = Nokogiri::XML(" foo bar ") parses an xml...
sudo gem install gettext --no-ri --no-rdoc sudo gem install fast_gettext --no-ri --no-rdoc script/plugin install git://...
See the lemonade descriptions. Unfortunately, the gem has a few problems: it does not work with Sass2...
install apache sudo apt-get install ruby1.8-dev sudo gem install passenger sudo passenger-install-apache2-module follow the instructions
When you need to patch an existing gem, one way is to "vendor" the gem by copying it into the...