Forum: Ruby on Rails RE: how to include an html file?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Berger, Daniel (Guest)
on 2006-02-21 21:38
(Received via mailing list)
> Other then that though you could simple open the file and
> spit the results manually. So, a simple helper function:
> def include_page(file_name)
>   result = ""
>, "r") { |f| result << }
>   result
> end

That can be shortened to:

def include_page(file_name)


Nick S. (Guest)
on 2006-02-21 21:54
(Received via mailing list)
Of course it can! :)
Thanks for that, there seems to always be a 'shorter' way in ruby!
Filip G. (Guest)
on 2006-02-21 22:01
Thanx guys!
Ezra Z. (Guest)
on 2006-02-22 06:23
(Received via mailing list)

<%= render :file => '/absolute/full/path/to/file' %>

And that will interpret any erb thats in the file as well.

This topic is locked and can not be replied to.