Converting Array to String in a model using before filters

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,

I have a list coming in a field like :selected\_lists => \[1,2,3,4\]

from a form

Correction :selected_lists => [1,2,3,4] to ---------> :lists_selected
=> [1,2,3,4]
Regards,
Vimal Das

----------------------------------------------------------------------------------
  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.

Because your attr_accessor overwrote the accessor which saves to a
database column with one that saves to an instance variable

So, is there anyother way to carry this out of the box

Regards,
Vimal Das

Thanks again Fred to make me try this out...
I got it after analysing ur reply further

So the trick is not to add a attr_accessor for lists_selected

Regards,
Vimal Das

Thanks again Fred to make me try this out...
I got it after analysing ur reply further

So the trick is not to add a attr_accessor for lists_selected

Regards,
Vimal Das