tags:

views:

86

answers:

2

How would you write this on the same line or on consecutive lines without do-end?

map.resources :magazines do |magazine| magazine.resources :ads end
+5  A: 

Instead of do/end, you could simply use {/}:

map.resources :magazines {|magazine| magazine.resources :ads}
mmarx
Yes, as long as the opening brace is on the same line as the method call.
mmarx
+5  A: 

wouldn't using curly braces work?

map.resources :magazines {|magazine| magazine.resources :ads}
Rob Di Marco