RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Introducing YAMLRecord!

At Miso, we occasionally ran into situations where we wanted to persist simple data to a text (or yaml) file. Examples include landing page email forms, contact us forms, feedback forms, about us “team” page, etc. In these situations, we wanted a way to persist data to YAML and easily view the results in a text file but also manage the data through forms and controllers as any other data. To do this we have created a YAML-backed persistence engine called YAMLRecord for those situations so we can access YAML based data using a familiar ActiveRecord API.

Comments

Seems to be interesting. Will try it next time ;)

Sounds great!

You can already query data from YAML files using the DataMapper dm-yaml-adapter.

Yeah I’ve seen that, thanks for the heads up though. In an existing Rails application using ActiveRecord though, I would prefer not to have to bring in the DM library alongside. We wanted a simple standalone solution in this case.

Sorry but this is useless for all practical purposes

DataMapper >= 1.0 can be loaded into Rails applications, alongside ActiveRecord, without a problem. You can also use DataMapper in place of ActiveRecord with dm-rails.

@postmodern You could run dm beside AR but why would you? All for the benefit of talking to a file on the filesystem?

@AnonymousCritic If the file contains a large amount (+1M) of relational data, then using DataMapper or YAMLRecord will save you time.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in