Forum: Ruby on Rails Connecting/Merging 2 different inputs

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
on 2009-01-18 12:10
(Received via mailing list)

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.

nas (Guest)
on 2009-01-19 15:54
(Received via mailing list)
how about this

def name_with_attendence
      [name, attendence].join(' ')

def name_with_attendence=(name_attendence)
    if name_attendence
       split_name_and_attendence = name_attendence.split(' ') = split_name_and_attendence.first
       self.attendence = split_name_and_attendence.last
      'name and attendece not valid'

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

On Jan 18, 10:09 am, "removed_email_address@domain.invalid"
This topic is locked and can not be replied to.