On 5 Nov 2008, at 14:28, Fernando Perez wrote:
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?
Well I was just thinking out loud really. Something like
module SubscriptionStuff
def subscriptions
Subscription.find_if_purchased
end
end
class MyController
include SubscriptionStuff
def show
subscriptions.xyz
end
end
I'm not saying that's a good idea though, it was just my first
reaction to your description.
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?
Find and replace has never bothered me. If I had something that had a
potentially conflicting name, I'd redefine the old method to raise an
error and run the specs again. But I've never needed to do this.
Ashley
--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users