Skip to content

Instantly share code, notes, and snippets.

@ukitazume
Created September 6, 2012 14:26
Show Gist options
  • Select an option

  • Save ukitazume/3656836 to your computer and use it in GitHub Desktop.

Select an option

Save ukitazume/3656836 to your computer and use it in GitHub Desktop.
class Controller
[400, 401, 402, 403, 404].each do |code|
define_method("render_#{code}", lambda {|message = 'error'| puts message})
end
end
controller = Controller.new
controller.render_400
controller.render_400('new message')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment