Connecting/Merging 2 different inputs


#1

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


#2

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”