Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def crazy_form_tag(&block)
  puts "Before Crazy Form Tag"
  yield
  puts "After Crazy Form Tag"
end


#so this is the normal way you do it
crazy_form_tag do
  puts "Hey I'm just a plain ol' block"
end

puts "------------------------"


# and here's another way
my_block_as_a_variable = lambda do
  puts "I'm some cool block goodness"
end

# and you pass that lambda to the method, note the ampersand!!!!!
crazy_form_tag(&my_block_as_a_variable)