Forum: Ruby on Rails RE: Re: how to output something from within <% %> tags?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hogan, Brian P. (Guest)
on 2006-02-23 19:21
(Received via mailing list)
Helpers are meant for this. That's why they exist. You put your output
code in the helper function and call it in your view. That's probably
why they disabled it.... It forces you to keep your views cleaner.
Filip G. (Guest)
on 2006-02-23 19:35
Hogan, Brian P. wrote:
> Helpers are meant for this. That's why they exist. You put your output
> code in the helper function and call it in your view. That's probably
> why they disabled it.... It forces you to keep your views cleaner.

er, so what helper code do I need? as I said, the one I tried gave me an
error. and being forced to use <%= is just making my views messier, cfr.
my example.
Kevin O. (Guest)
on 2006-02-23 19:49
(Received via mailing list)
Just stuff all that messy logic into a helper and call that

instead of

<% code
   more code
   output something %>

you could do

<%= fancy_helper %>

where fancy_helper is

def fancy_helper
 code
 more code
 output something
end

_Kevin

if that doesn't do the trick, try posting some real code from your view
and I'm sure we could find a way to clean it up.
This topic is locked and can not be replied to.