Hi, ERB allows you to shortcut the <% Ruby code goes here %> tag with a single % % A line of Ruby code goes here. It has to be the whole line. To access this functionality, Rails would need to be careful when setting up the ERB object: template = ERB.new(..., ''%'') Does Rails support this shortcut? I''m purposefully not looking up the documentation, because if it does and I don''t know by now, it''s perhaps not well enough documented. Cheers, Gavin
> % A line of Ruby code goes here. > > Does Rails support this shortcut? I''m purposefully not looking up the > documentation, because if it does and I don''t know by now, it''s > perhaps not well enough documented.Interesting feature, didn''t know about it. I''m a bit undecided as to whether I think it''s a good idea. I could easily see how you could accidently trigger it. And I have <% %> and <%= %> assigned to hotkeys in TextMate anyway ;) -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain
On Tuesday, November 16, 2004, 10:32:19 PM, David wrote:>> % A line of Ruby code goes here. >> >> Does Rails support this shortcut? I''m purposefully not looking up the >> documentation, because if it does and I don''t know by now, it''s >> perhaps not well enough documented.> Interesting feature, didn''t know about it. I''m a bit undecided as to > whether I think it''s a good idea. I could easily see how you could > accidently trigger it.Just for completeness, if you want a literal % at the start of the line, you use (predictably enough) %%. And it''s not like a mistake would survive testing. But I''m not suggesting it should be the default. And it''s quite possibly more trouble than it''s worth to offer configuration.> And I have <% %> and <%= %> assigned to hotkeys in TextMate anyway ;)True, but creating and maintaining are different things :) Gavin