[rspec-users] Design Pattern proposal for better Rails development

Pat Maddox pergesu at gmail.com
Wed Nov 5 09:42:38 EST 2008


Fernando Perez <lists at ruby-forum.com> writes:

>> Hmmm, could you make a helper module and mix that into all three
>> controllers?  Then there'd be just one place to change it.
>> 
> Can you be more descriptive?
>
> Let's say I have:
>
> def show
>   Subscription.find_if_purchased
>   ...
> end
>
> def update
>   Subscription.find_if_purchased
>   ...
> end
>
>
> Now if I change the method name to find_if_subscribed in the model, then 
> necessarily I will have to change it twice in my controller, well I 
> could use a before_filter, but what if the method is also called in 
> other controllers? That's the main problem. How would you do that?

I don't think this is a problem.

Pat


More information about the rspec-users mailing list