require 'family'
require 'friends'
class WeddingController < LifeController
def we_are_getting_married
@wedding.groom = 'ME'
@wedding.bride = 'HER'
end
def wedding_location
redirect_to :some_city => :some_country
end
def wedding_date
@wedding.date = "2008.01.01"
end
end
Refactorings
No refactoring yet !
lagsalot.myopenid.com
December 28, 2007, December 28, 2007 17:17, permalink
require 'family'
require 'friends'
class WeddingController < LifeController
def initialize
puts "Congratulations"
honeymoon_over if wedding.date < Time.now
end
def we_are_getting_married
@wedding.groom = 'ME'
@wedding.bride = 'HER'
end
def wedding_location
redirect_to :some_city => :some_country
end
def wedding_date
@wedding.date = "2008.01.01"
end
def honeymoon_over
@wedding = nil && drain_bank
end
def drain_bank
@wife = Wife.new
while account_balance > 0.00
account_balance = account_balance - @wife.shoes.price
account_balance = account_balance - @wife.cloths.price
account_balance = account_balance - @wife.car.price
account_balance = account_balance - @wife.furnishings.price
account_balance = oh_damn if @wife.spawned_offspring?
end
end
def oh_damn
- 200000.00 * @wife.spawn.count
end
end
Crazy Wedding Controller! Can you guys help me refactor it with more fun!