# Non-database Model for validations

**URL:** <https://www.ruby-forum.com/t/non-database-model-for-validations/138513>\
**Category:** Rails\
**Created:** [May 23, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/non-database-model-for-validations/138513 "2008-05-23T21:17:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccuilla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/77aa72/32.png) [@ccuilla](https://www.ruby-forum.com/u/ccuilla)\
**Post date:** [May 23, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/non-database-model-for-validations/138513/1 "2008-05-23T21:17:36Z")

</div>

I want to have a model (e.g., a “credit\_card” object) that behaves  
like an ActiveRecord model in every way EXCEPT saving to the database.

The use case is like this:

1. User gets a signup screen with a credit card form
2. User fills out and submits form
3. Controller receives data and performs validations

4a. Controller presents validation errors to user  
4b. Model passes validation, controller uses something like  
ActiveMerchant to convey the credit card information to a payment  
gateway, but does NOT store the information locally.

In other words, use Rails MVC to control the front end of the use case  
(with an emphasis on model validation), while utilizing something like  
[Authorize.net](http://Authorize.net)’s services for storing payment information.

Can this be done?

---

<div class="post-metadata">

**Author:** ![ccuilla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/77aa72/32.png) [@ccuilla](https://www.ruby-forum.com/u/ccuilla)\
**Post date:** [May 25, 2008, 2:57am UTC](https://www.ruby-forum.com/t/non-database-model-for-validations/138513/2 "2008-05-25T02:57:44Z")

</div>

I have not watched them but this site:

[http://www.rubyplus.org/episodes/archive](http://www.rubyplus.org/episodes/archive)

has three screen casts about [Authorize.net](http://Authorize.net) and ActiveMerchant

HTH  
pedz
