Actions with dashes
October 25th, 2005
Want to get an action with a dash in it’s name and still do something useful ? Try this:
1 2 3 4 5 6 7 |
class WelcomeController < ApplicationController define_method("sign-up".to_sym) do if request.post? then # Do something end end end |
Of course, if you don’t have anything to do, just name the view file appropriately: app/views/welcome/sign-up.rhtml.