How do you pass arguments to define_method?

The block that you pass to define_method can include some parameters. That’s how your defined method accepts arguments. When you define a method you’re really just nicknaming the block and keeping a reference to it in the class. The parameters come with the block. So:

define_method(:say_hi) { |other| puts "Hi, " + other }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)