Skip to content

fronx/yaml_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
François Wurmus
Dec 19, 2008
310abe3 · Dec 19, 2008

History

3 Commits
Dec 19, 2008
Dec 19, 2008
Dec 19, 2008
Dec 19, 2008
Dec 19, 2008
Dec 19, 2008
Dec 19, 2008
Dec 19, 2008

Repository files navigation

YamlModel
=========

Declare your own YAML-based models by inheriting from YamlModel::Base.

Example
=======

class Book < YamlModel::Base
  fields :title, :author, :content
end

Book.setup  # creates the data file RAILS_ROOT/data/book.yml
Book.all    # returns all records from book.yml

book = Book.first
puts book.title
puts book.author
puts book.content

Data file format (example)
==========================
- 
title: the book about some thing
author: tim
content: bla bli blub
- 
title: book with structured content
author: fronx
content:
  chapter1: please read on in chapter 2.
  chapter2: and now, move back to the top, please.


Copyright (c) 2008 François Wurmus, released under the MIT license

About

YAML storage for objects (Rails Plugin)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages