# How to create feed and write that feed to a file

**URL:** <https://www.ruby-forum.com/t/how-to-create-feed-and-write-that-feed-to-a-file/126195>\
**Category:** Rails\
**Created:** [January 16, 2008, 7:28am UTC](https://www.ruby-forum.com/t/how-to-create-feed-and-write-that-feed-to-a-file/126195 "2008-01-16T07:28:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [January 16, 2008, 7:28am UTC](https://www.ruby-forum.com/t/how-to-create-feed-and-write-that-feed-to-a-file/126195/1 "2008-01-16T07:28:22Z")

</div>

Creating RSS feed is easy and there are many articles on that.

However my requirement is to generate and write that feed as a file  
(88.feed 89.feed etc). These feeds would be generated through cron every  
night. Any idea how I can capture the output as a string.

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [January 16, 2008, 8:57am UTC](https://www.ruby-forum.com/t/how-to-create-feed-and-write-that-feed-to-a-file/126195/2 "2008-01-16T08:57:43Z")

</div>

U can do a curl and pipe it to a file

Sent from my iPhone

On Jan 15, 2008, at 10:28 PM, Raj S.  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [January 16, 2008, 9:43pm UTC](https://www.ruby-forum.com/t/how-to-create-feed-and-write-that-feed-to-a-file/126195/3 "2008-01-16T21:43:39Z")

</div>

That’s what I am doing right now. But that seem ugly. Was wondering if  
there is a better way.

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [January 17, 2008, 12:05am UTC](https://www.ruby-forum.com/t/how-to-create-feed-and-write-that-feed-to-a-file/126195/4 "2008-01-17T00:05:53Z")

</div>

On 1/16/08, Raj S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That’s what I am doing right now. But that seem ugly. Was wondering if  
> there is a better way.

This is normally done using Rails page caching.

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)
