# Heroku progamming

**URL:** <https://www.ruby-forum.com/t/heroku-progamming/186433>\
**Category:** Ruby\
**Created:** [April 7, 2010, 5:20am UTC](https://www.ruby-forum.com/t/heroku-progamming/186433 "2010-04-07T05:20:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@thunk](https://www.ruby-forum.com/u/thunk)\
**Post date:** [April 7, 2010, 5:20am UTC](https://www.ruby-forum.com/t/heroku-progamming/186433/1 "2010-04-07T05:20:53Z")

</div>

> **[Heroku](https://en.wikipedia.org/wiki/Heroku)**
>
> Heroku is a cloud platform as a service (PaaS) supporting several programming languages. One of the first cloud platforms, Heroku has been in development since June 2007, when it supported only the Ruby programming language, but now supports Java, Node.js, Scala, Clojure, Python, PHP, and Go. For this reason, Heroku is said to be a polyglot platform as it has features for a developer to build, run and scale applications in a similar manner across most languages. Heroku was acquired by Salesfo He...

Hello,

We have a Ruby program that:

1. Is based on Wee + rack
2. Accepts input from a browser/client
3. Generates a text file, which is also a ruby class

Is this an appropriate ‘Ruby’ topic?

If so:

1 Does ‘Heroku’ seem like the best place for such a simple program?  
2. There seemed to be issues with simple file saving but we have no  
long term interest in RDMS (would use couchDB/JSON)

If it is, can anybody point to potential problems?

Respectfully,

gk

---

<div class="post-metadata">

**Author:** ![thunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@thunk](https://www.ruby-forum.com/u/thunk)\
**Post date:** [April 7, 2010, 5:32am UTC](https://www.ruby-forum.com/t/heroku-progamming/186433/2 "2010-04-07T05:32:34Z")

</div>

On Tue, Apr 6, 2010 at 10:20 PM, thunk [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. Generates a text file, which is also a ruby class
> 
> Respectfully,
> 
> gk

3 will be a problem, you can’t write to Heroku’s file system. When we  
deploy  
on Heroku, we use Amazon to store files (pictures, mp3s, etc).

---

<div class="post-metadata">

**Author:** ![thunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@thunk](https://www.ruby-forum.com/u/thunk)\
**Post date:** [April 7, 2010, 6:01am UTC](https://www.ruby-forum.com/t/heroku-progamming/186433/3 "2010-04-07T06:01:15Z")

</div>

On Apr 6, 10:32 pm, Josh C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > We have a Ruby program that:  
> > 2. There seemed to be issues with simple file saving but we have no  
> > long term interest in RDMS (would use couchDB/JSON)
> 
> > If it is, can anybody point to potential problems?
> 
> > Respectfully,
> 
> > gk
> 
> 3 will be a problem, you can’t write to Heroku’s file system. When we deploy  
> on Heroku, we use Amazon to store files (pictures, mp3s, etc).

Josh,

Your point, is what I remember not being clear about.

Thank you!

On a single user system we are using the following code to load  
textfiles into the program as executable classes.

[http://gist.github.com/358497](http://gist.github.com/358497)

I remain unclear if this can be done on Heroku, and how.

Can the newly created text file be saved to Amazon?

If so, how is this done? (Normal File IO? somehow?)

If we stored the text files into a RDMS, can you think of a way to  
become classes in the running program?

Is there a “work-around” to accomplish this somehow?

Thank you!

gk

---

<div class="post-metadata">

**Author:** ![thunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@thunk](https://www.ruby-forum.com/u/thunk)\
**Post date:** [April 7, 2010, 6:18am UTC](https://www.ruby-forum.com/t/heroku-progamming/186433/4 "2010-04-07T06:18:13Z")

</div>

On Apr 6, 2010, at 9:00 PM, thunk wrote:

> If we stored the text files into a RDMS, can you think of a way to  
> become classes in the running program?

If you really want to do this (and you’ll probably regret it later,  
honestly), you can store the scripts in a text column in a DB table and  
have them “become classes” using Kernel#eval.

~ j.

---

<div class="post-metadata">

**Author:** ![thunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@thunk](https://www.ruby-forum.com/u/thunk)\
**Post date:** [April 7, 2010, 7:00am UTC](https://www.ruby-forum.com/t/heroku-progamming/186433/5 "2010-04-07T07:00:56Z")

</div>

> If you really want to do this (and you’ll probably regret it later, honestly), you can store the scripts in a text column in a DB table and have them “become classes” using Kernel#eval.
> 
> ~ j.

Thank you!

Understood. We have worked to remove all Evals as low performance,  
and as “debugger unfriendly”.

A work-around comes to mind using a couchDB type “document base” using  
Jason that would seem to be faster and less dangerous. Are there any  
of these types of document bases “approved” for Heroku? I see only  
Amazon RDS mentioned directly.

The unique part of each class is a single method. This method could  
be overwritten using a the define\_singleton\_method (as best I  
remember).  
This would only be in memory, but would seem to be a fast and  
otherwise clean work-around (assuming of course the that text can be  
safely stored somewhere)

(The text file being written would also be lost under circumstances.)

BTW I tried marshaling the object with Singleton methods to files -  
and Ruby will not like this 🙂 - but the pickAx book points out a way  
to do it as I remember.

This all seems more involved than it should be.

Are there, perhaps, Heroku “semi-commercial” programs available where  
this is not a problem?

Is this all for security reasons?

Respectfully,

gk
