views:

174

answers:

1

Let's say I have a Rails app that gets most of it's functionality from a gem (for instance, a CMS).

If I now need to add some customisation (for instance, add a property to a user) what is the best practice way of doing this? If I customise the gem, then I will have issues with updating the gem in the future.

What is the best approach to take here?

+1  A: 

Ruby allows you to extend classes in runtime, so you can often hack in to a library without touching the source code. Otherwise I would suggest that you download the gem, create some hooks in the library and submit that back as a patch.

Update:

Note that these customisations are application specific

Yes. What I meant was to modify the generic api in a way, such that it is possible to customise per application. For example, by allowing the user to pass a block to certain methods etc.

troelskn
Note that these customisations are application specific
Neil Middleton