# Using form fields that arent in database

**URL:** <https://www.ruby-forum.com/t/using-form-fields-that-arent-in-database/131085>\
**Category:** Rails\
**Created:** [March 5, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/using-form-fields-that-arent-in-database/131085 "2008-03-05T22:14:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [March 5, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/using-form-fields-that-arent-in-database/131085/1 "2008-03-05T22:14:22Z")

</div>

Basically I need to know how to use forms fields when the attribute name  
for it  
doesn’t match a field in my database. I have a form like this.

\<%= date\_select 'assessment', 'ends\_at\_date', :value =\> "Click here..." %\> \<%= time\_select 'assessment', 'ends\_at\_time'%\>

My database has a field called ends\_at which is a datetime field that  
should have the combination of these 2 forms fields. However, I dont  
know how to interact with the values of form fields with ruby in order  
to do that. This gives me an error right now because there are no  
database fields called ends\_at\_date or ends\_at\_time to correspond to.  
Does anyone know how i can take the values of these fields and mess with  
them so i can input what i want in my ends\_at field? Perhaps through the  
model or controller. Thanks alot 😃

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [March 5, 2008, 10:22pm UTC](https://www.ruby-forum.com/t/using-form-fields-that-arent-in-database/131085/2 "2008-03-05T22:22:35Z")

</div>

Sounds like what you need is a virtual attribute. Check out the  
Railscast on  
it at:

> **[\#16 Virtual Attributes - RailsCasts](http://railscasts.com/episodes/16-virtual-attributes)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

On Wed, Mar 5, 2008 at 1:14 PM, Mark Mr  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> should have the combination of these 2 forms fields. However, I dont

–  
Henry  
[http://www.henrywagner.org/](http://www.henrywagner.org/)
