Hi,

    I have a list coming in a field like :selected_lists => [1,2,3,4]
from a form
    while storing it in a database i need to join this list into a
string

   so then in my model class,
___________________________________________________
   1) Added a filter          before_save :convert_array_to_string
   2) Added an               attr_accessor :selected_lists
___________________________________________________
   def convert_array_to_string
     self.lists_selected = self.lists_selected.join(",")
     puts self.lists_selected
     return true
   end
----------------------------------------------------------------------------------
   so that before saving i call a function to format the array to
string and store it using attr_accessor method
   I printed the "self.lists_selected" and i got "1,2,3,4" as the
result

   I thought this would do my job
   I am wondering why 'nil' is stored in the table.
   Please help me out off this guys.

Regards,
Vimal Das
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to