# Inheriting from ActiveRecord::Base with no DB table

**URL:** <https://www.ruby-forum.com/t/inheriting-from-activerecord-base-with-no-db-table/176659>\
**Category:** Rails\
**Created:** [October 4, 2009, 7:23am UTC](https://www.ruby-forum.com/t/inheriting-from-activerecord-base-with-no-db-table/176659 "2009-10-04T07:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [October 4, 2009, 7:23am UTC](https://www.ruby-forum.com/t/inheriting-from-activerecord-base-with-no-db-table/176659/1 "2009-10-04T07:23:22Z")

</div>

Hi.

I need to upload a CSV file in my application and I am trying to do so  
with a sample I found googling around, which defines a model that  
inherits from ActiveRecord::Base.

The problem I am having is that whenever an error occurs Rails  
complains because there is no DB table behind the model, which I don’t  
need since there would be nothing to be stored in it.

I would like to be able to not have the table and also use  
ActiveRecord::Errors capabilities since I would like to keep the look  
and feel of the rest of the page when handling errors.

Is there a way of telling Rails that there is no table behind the  
model? And if that is not possible, is there a way to instantiate an  
ActiveRecord::Errros object inside the class without inheriting from  
ActiveRecord::Base and make it work the same way as it usually does?

Thanks.

Pepe

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [October 4, 2009, 12:37pm UTC](https://www.ruby-forum.com/t/inheriting-from-activerecord-base-with-no-db-table/176659/2 "2009-10-04T12:37:02Z")

</div>

A few minutes googling gave me a plugin:  
[http://agilewebdevelopment.com/plugins/activerecord\_base\_without\_table](http://agilewebdevelopment.com/plugins/activerecord_base_without_table)

You will get all classes along with the validation classes from  
ActiveRecord in this way. Besides you wont need any corresponding  
table for this model.

I didnt try it out yet but hope you may find it usable.  
Let me know if it worked for you. Then we would use it if necessary…

Thank you

Samiron paul

> **[Small Talk](https://samironpaul.blogspot.com/)**

> **[亚搏APP手机版-官方网站](http://www.scrumpad.com)**
>
> 亚搏app手机版下载是亚洲最具规模且成长最快的在线娱乐之一,当前国内最知名的游戏娱乐平台,汇聚了最新最热最好玩百款精彩游戏,国内最具影响力娱乐平台!

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [October 4, 2009, 5:39pm UTC](https://www.ruby-forum.com/t/inheriting-from-activerecord-base-with-no-db-table/176659/3 "2009-10-04T17:39:05Z")

</div>

Thanks Samiron,

I appreciate you spending your time to help me out. I spent quite a  
bit of time googling myself but didn’t come across this link. I was  
hoping ActiveRecord itself would have something built in to it. I took  
a look at attachment\_fu but it was way overkill for what I need. I’ll  
also take a look at paperclip to see if that is also a good fit.

Thanks a lot! 🙂
