Hi, I have a multiple checkbox of values 1 to 7 for selecting weekdays. What is the possibility of storing the selected weekdays array in mysql and what type of field should i create in the table for storing the array. Any suggestions??? 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 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 -~----------~----~----~----~------~----~------~--~---
Sumanth Krishna
2009-Mar-13 12:33 UTC
Re: storing and retrieving arrays in mysql using rails
Interesting,
nothing extra tweaks are required to achieve this.
<%= select_tag "days[]", options_for_select([ "Mon",
"Tue", "Wed",
"Thu","Fri","Sat","Sun",],
"Monday"),:multiple => true %>
This would ensure that your selection is stored into array "days[]".
You can store this as string into db with a delimiter of your choice
[preferably days.join(",")].
hope it was useful, else post me more details :)
On Fri, Mar 13, 2009 at 2:16 PM, vimal
<cool.vimalsmail-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi,
>
> I have a multiple checkbox of values 1 to 7 for selecting weekdays.
>
> What is the possibility of storing the selected weekdays array in
> mysql
> and what type of field should i create in the table for storing the
> array.
> Any suggestions???
>
> Regards,
> Vimal Das
>
> >
>
--
--
Thanks & Regards,
Sumanth Krishna. A
+358 40 3276564
Blogs:
TwinclingCommunity:
http://sumanthtechsavvy.blogspot.com/
http://www.twincling.org/node/227
http://yourway2health.blogspot.com/
http://www.osef.twincling.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Cool suggestion :) Thanks! Sumanth --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- - 2.3.2 uninitialized constant ApplicationController
- Retrieving all values of the column from the table
- ActionController::RoutingError (no route found to match "/ja
- Your command, Re: Your application, was invalid
- Your command, Re: Your application, was invalid