# Connecting/Merging 2 different inputs

**URL:** <https://www.ruby-forum.com/t/connecting-merging-2-different-inputs/158037>\
**Category:** Rails\
**Created:** [January 18, 2009, 11:10am UTC](https://www.ruby-forum.com/t/connecting-merging-2-different-inputs/158037 "2009-01-18T11:10:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 18, 2009, 11:10am UTC](https://www.ruby-forum.com/t/connecting-merging-2-different-inputs/158037/1 "2009-01-18T11:10:01Z")

</div>

Hi

I have a form which contain a student names and their attendance.  
For each student name there is a text box to input attendance.I want  
to create a connection between the ‘name’ and it’s attendance. I think  
I should merge the student name and the attendance.But could not  
achieve it as yet.

Can nyone give me an idea how to do this.

Thanks  
Viper

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 19, 2009, 2:54pm UTC](https://www.ruby-forum.com/t/connecting-merging-2-different-inputs/158037/2 "2009-01-19T14:54:42Z")

</div>

how about this

def name\_with\_attendence  
[name, attendence].join(’ ')  
end

def name\_with\_attendence=(name\_attendence)  
if name\_attendence  
split\_name\_and\_attendence = name\_attendence.split(’ ')  
self.name = split\_name\_and\_attendence.first  
self.attendence = split\_name\_and\_attendence.last  
else  
‘name and attendece not valid’  
end  
end

above i am only checking the presence of name\_attendence but not its  
format or any other stuff that you might have to add in your model or  
code

On Jan 18, 10:09 am, “removed\_email\_address@domain.invalid”
