# ActiveRecord without database

**URL:** <https://www.ruby-forum.com/t/activerecord-without-database/98729>\
**Category:** Rails\
**Created:** [January 30, 2006, 10:08am UTC](https://www.ruby-forum.com/t/activerecord-without-database/98729 "2006-01-30T10:08:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f1d935/32.png) [@reis](https://www.ruby-forum.com/u/reis)\
**Post date:** [January 30, 2006, 10:08am UTC](https://www.ruby-forum.com/t/activerecord-without-database/98729/1 "2006-01-30T10:08:07Z")

</div>

The question is this.  
Can I use ActiveRecord without the presence of a database?  
I use only YAML file for my project and I would like use the power of  
ActiveRecord for my models. I have not tested and so I ask you if this  
is possible.

Thanks so much.  
–Reis

---

<div class="post-metadata">

**Author:** ![reis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f1d935/32.png) [@reis](https://www.ruby-forum.com/u/reis)\
**Post date:** [January 30, 2006, 10:35am UTC](https://www.ruby-forum.com/t/activerecord-without-database/98729/2 "2006-01-30T10:35:29Z")

</div>

[http://wiki.rubyonrails.org/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord](http://wiki.rubyonrails.org/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord)  
[http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects](http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects)

On 1/30/06, Andrea R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The question is this.  
> Can I use ActiveRecord without the presence of a database?  
> I use only YAML file for my project and I would like use the power of  
> ActiveRecord for my models. I have not tested and so I ask you if this  
> is possible.

–  
kind\_regards = {  
:name =\> “Arie”,  
:Y! =\> “riyari3”,  
:email =\> “removed\_email\_address@domain.invalid”  
}

---

<div class="post-metadata">

**Author:** ![reis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f1d935/32.png) [@reis](https://www.ruby-forum.com/u/reis)\
**Post date:** [January 30, 2006, 11:41am UTC](https://www.ruby-forum.com/t/activerecord-without-database/98729/3 "2006-01-30T11:41:43Z")

</div>

Arie Kusuma A. wrote:

> [http://wiki.rubyonrails.org/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord](http://wiki.rubyonrails.org/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord)  
> [http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects](http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects)

Thanks soo much for the link.  
–Reis

---

<div class="post-metadata">

**Author:** ![reis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f1d935/32.png) [@reis](https://www.ruby-forum.com/u/reis)\
**Post date:** [January 30, 2006, 6:28pm UTC](https://www.ruby-forum.com/t/activerecord-without-database/98729/4 "2006-01-30T18:28:51Z")

</div>

On Jan 30, 2006, at 1:08 AM, Andrea R. wrote:

> The question is this.  
> Can I use ActiveRecord without the presence of a database?  
> I use only YAML file for my project and I would like use the power of  
> ActiveRecord for my models. I have not tested and so I ask you if this  
> is possible.
> 
> Thanks so much.  
> –Reis
> 
> –

You can easily use rails without using ActiveRecord for the models.  
If you just want to use yaml as your models then you are already  
there you can eaily just load yaml into hashes or arrays and use them  
in the views or wherever. But If you want database type relationships  
you will need to use AR or maybe you want to look at kirbybase, a  
pure ruby database that is nice and powerfull and uses ruby blocks as  
its query language. Kirbybase stores its database in a plain text  
file but has indexes so its still very fast.

```
But alas, the power of rails is closely tied to ActiveRecord and I

```

think that you will be swimming upstream without it once things get  
complicated. Can you elaborate on what you want to do that doesn’t  
need a database but needs to store in yaml files?

Cheers

-Ezra Z.  
Yakima Herald-Republic  
WebMaster

> **[yakimaherald.com | Yakima, Washington - We Tell Your Stories](https://www.yakimaherald.com/)**

509-577-7732  
removed\_email\_address@domain.invalid
