views:

53

answers:

2

I'm trying to use a yaml config file as a very simple flat file db for a small rails app. The app has a single user, so I just need a way to store a username and password. The only thing is that I'd like to be able to edit the username and password while still inside the app and not require an app restart (so I can't load the YAML file inside an initializer...).

Any ideas on how I could accomplish this? I'm not married to the idea of using YAML, so if you have a better suggestion I'm all ears!

+2  A: 
John Topley
so you'd recommend just having an entire users table for one user then? That's what I was originally going to do but it seemed hugely overkill...perhaps it is the best solution, however.
Ryan
I don't see it as being a big deal, it's not like it's going to take up a hugh amount of disk space or anything. SQLite 3 is the storage mechanism for iPhone applications, to give you some context of what else it's used for. Personally I don't see the advantage of writing a persistence mechanism when Rails already has a great solution built in i.e. ActiveRecord.
John Topley
I agree, I guess I just wanted to make sure there wasn't a better way. Thanks for your input!
Ryan
A: 

http://rubyforge.org/projects/rbyaml

http://yaml4r.sourceforge.net/doc/

(http://www.yaml.org/)

Theofanis Pantelides
Thanks for the suggestions Theofanis, I'll check them out!
Ryan