There are a few ways of modularising your code. Here are some ways how I currently do it.

Gem modularity: https://github.com/makandra/modularity

Active Support::Concern: http://api.rubyonrails.org/classes/ActiveSupport/Concern.html

… watch the 37signals video on how they do it