Storing form data in xml file

Hi I am writing an application where the form data needs to be stored as xml file. I cannot use data base as I want to provide version management for this data (currently planning on SVN). The form data is a perl script file. Users write the perl script in the form and save it to the server (which gets saved as .pl file). The web UI also provides a way to execute that file by clicking the execute button. On the server the file gets executed and output is stored into a log file. I would like to manage these log files using the web UI

The UI wireframe looks some thing like this

Add New Script (button)

Show current Scripts

1.pl Edit Execute Manage-Versions Delete Rename Copy 2.pl Edit Execute Manage-Versions Delete Rename Copy . . .

Please help me on how I can create a model for this. Model is not a data base (I will eventually create a database to store the list of scripts and their metadata, but the content of the scripts is going to be in a file)

I need a config variable, that defines where the data can be stored on the file system. Where can I put this config and how can I access it

DATA_STORAGE = /opt/perlscripts/

How can I use this model to write a CLI program, along with the webUI (for CLI fans)

thanks a lot in advance

Kiran

How can I use this model to write a CLI program,

Well, you might offer random people $100 so that you can get them to read through all your specs. Then you can pay someone $5,000 to write the code for you.

gl

Thanks, that helped me a lot :slight_smile:

I don't need the model or the code, all I want is the way to store the data in a file in a directory. How do I keep track of the variables. The reason why I explained in detail: I looked at other posts and got suggestions saying why don't you store the data in the database. That's not going to help me because of the reasons mentioned

Thanks, that helped me a lot :slight_smile:

I don't need the model or the code, all I want is the way to store the data in a file in a directory. How do I keep track of the variables. The reason why I explained in detail: I looked at other posts and got suggestions saying why don't you store the data in the database. That's not going to help me because of the reasons mentioned

render to string, then File.new('path/to/file', 'w').print your_string

That's assuming you will only ever do this once per file, and wipe out the file if you need to do it again. Look at the File class for the relevant flags to #open -- there are some that will let you append lines or rewrite an existing file (create it if it's not there) etc.

Walter

Hi

I am writing an application where the form data needs to be stored as

xml file. I cannot use data base as I want to provide version

management for this data (currently planning on SVN). The form data is

a perl script file. Users write the perl script in the form and save

it to the server (which gets saved as .pl file). The web UI also

provides a way to execute that file by clicking the execute button. On

the server the file gets executed and output is stored into a log

file. I would like to manage these log files using the web UI

On form submit, save the script to a temp file or an IO object, and use it as a

paperclip attachment to a script model.

As for the output logging, you can create another model that has the log files as

attachments, and is connected to the script model in a one-to-many relationship.