Re: Refactoring my code

IMO this is the best way to put it. There would probably by a DRYer way (e.g. using with_options - although I'm not sure if that works across different models), but nothing as readable. You should never give up clarity just for a little more DRYness.

Visit http://www.railway.at for quality Rails contract work. We also blog about Rails, AJAX and other things.

Re: Refactoring my code

clemens wrote:

IMO this is the best way to put it. There would probably by a DRYer way (e.g. using with_options - although I'm not sure if that works across different models), but nothing as readable. You should never give up clarity just for a little more DRYness.

I completely agree with clemens about clarity over DRYNess.

However, just for the sake of answering the question, you could do this: