From: "David A. Black" Date: 2007-10-22T01:39:46+09:00 Subject: Re: "with" statement Hi -- On Mon, 22 Oct 2007, Perry Smith wrote: > Pascal has a with statement. (I'm showing my age). It would be nice > instead of: > > <%= h relationship.parent_id %> > <%= h relationship.link_type.pcln %> > <%= h relationship.child_id %> > <%= h relationship.active %> > <%= h relationship.notes %> > <%= h relationship.created_at %> > <%= h relationship.updated_at %> > > I could do: > > with(relationship) { > <%= h parent_id %> > <%= h link_type.pcln %> > <%= h child_id %> > <%= h active %> > <%= h notes %> > <%= h created_at %> > <%= h updated_at %> > } You can use instance_eval: david-a-blacks-computer:~ dblack$ erb <% a = "hi" %> <% a.instance_eval do %> <%= upcase %> <% end %> ^D HI David -- Upcoming training from Ruby Power and Light, LLC: * Intro to Ruby on Rails, Edison, NJ, October 23-26 * Advancing with Rails, Edison, NJ, November 6-9 Both taught by David A. Black. See http://www.rubypal.com for more info!