web.archive.org

With its you can switch the subject of an example to a method value of the current subject: describe Array...

Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...

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

This will show you how to create a RSS feed that the Feed Validator considers valid. Note that RSS is...

You should test the callback methods and its correct invocation in two separate tests. Understand the ActiveRecord note before you...

Be careful! The following solution will delete files on a volume. If you don't know exactly what you're...

emphaticsolutions.com

In a great post about named routes in Rails, path vs. url, Viget Labs ponders which variant is best used...

makandra dev
w3.org

The following Haml will do: %head{ :profile => 'http://www.w3.org/2005/10/profile' } %link{ :href => image_path('favicon.ico'), :rel => 'icon', :type => 'image/vnd.microsoft.icon' }

makandra dev

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...

github.com

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:

regular-expressions.info

You can write regular expressions some different ways, e.g. /regex/ and %r{regex}. For examples, look here. Remember that it...

github.com

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...

github.com

An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...

makandra dev

Ubuntu lets you mount an SSH shell into Nautilus from Places -> Connect to server (select "SSH" as server type).

blog.peepcode.com

The Rails router has been written and rewritten at least four times2, including a recent rewrite for the upcoming Rails...

github.com

Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a...

makandra dev

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