Hi all,
please i have an array in my rails application (for example; $x = [23,
how, this,56, you, nice])
I want to store it in a mysql database as a SINGLE RECORD with a
name .
thus i can get each array with its name and still be able to access
the array like an array
i.e $x[0] # => 23
$x[1] # => how
.....and so on
I don''t know what DATA TYPE to use and how to do it.
any sugesstion is welcomed.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
you can take varchar dear i hope it will work.. On Mar 28, 1:38 pm, kevid <alumsimport...-FFYn/CNdgSA@public.gmane.org> wrote:> Hi all, > > please i have an array in my rails application (for example; $x = [23, > how, this,56, you, nice]) > > I want to store it in a mysql database as a SINGLE RECORD with a > name . > > thus i can get each array with its name and still be able to access > the array like an array > > i.e $x[0] # => 23 > $x[1] # => how > > .....and so on > > I don''t know what DATA TYPE to use and how to do it. > > any sugesstion is welcomed.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Am 28.03.2010 um 10:38 schrieb kevid:> please i have an array in my rails application (for example; $x = [23, > how, this,56, you, nice]) > > I want to store it in a mysql database as a SINGLE RECORD with a > name . > > thus i can get each array with its name and still be able to access > the array like an array > > i.e $x[0] # => 23 > $x[1] # => how > > .....and so on > > I don''t know what DATA TYPE to use and how to do it.See "Saving arrays, hashes, and other non-mappable objects in text columns" in http://api.rubyonrails.org/classes/ActiveRecord/Base.html Felix -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Why is the name of your variable starting with ''$''? Names starting with ''$'' are reserved for environment variables. I''m not sure about ''$x'' but you better follow ruby and rails guidelines for naming variables or you may be asking for trouble. On Mar 28, 4:10 pm, Felix Schäfer <schae...-SjIeUF6ADzXby3iVrkZq2A@public.gmane.org> wrote:> Am 28.03.2010 um 10:38 schrieb kevid: > > > please i have an array in my rails application (for example; $x = [23, > > how, this,56, you, nice]) > > > I want to store it in a mysql database as a SINGLE RECORD with a > > name . > > > thus i can get each array with its name and still be able to access > > the array like an array > > > i.e $x[0] # => 23 > > $x[1] # => how >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.