mayukarunasekara-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Jan-18 10:09 UTC
Connecting/Merging 2 different inputs
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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,
"mayukarunasek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<mayukarunasek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---