The original:
http://pastie.textmate.org/private/lqvrlyyvkv2kbugoxtiz6w
Send your submissions to me by email or on #merb. I'll blog it, and
pick a winner. The winner does not mean it makes it into Merb, just
means I personally like it best.
But it might make it into Merb.
# Scenario:
# You have a simple application that lists all the monkeys at the zoo.
# Every monkey has a name, and that name is unique.
# It is currently working.
#
# Your boss comes and asks you to change the "ugly" /monkeys/44 URLs
# to be "pretty" and "SEO optimized" URLs like /monkeys/koko, with the
# monkey's name in the URL.
#
# Challenge:
# Design your perfect API for doing this, using any combination of
# controller, model, and router changes. Submit it as a diff of this
pastie.
#
# Degree of difficulty:
# Don't complain that doing /monkeys/koko is dumb, or what happens
# when there are two monkeys named koko.
#
# Submit your diffs to #merb
# router:
r.resources :monkeys
class Monkey < MythicalORM
end
class Monkeys < Application
def show(id)
@monkey = Monkey.find(id)
end
def create(monkey)
@monkey = Monkey.create(monkey)
redirect url(:monkey,@monkey)
end
end
_______________________________________________
Merb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/merb-devel