On 30 December 2010 13:51, Prasad B. <li...@ruby-forum.com> wrote:
> i have a registration form ,i want to store data in corresponding user
> table in that hobbies field
> ,i want to store all hobbies in one column so i take multiple check
> boxes and store in one array

At the risk of making the the thread start sounding like a broken
record : "no you do not".

It's a dreadful idea to try to store all the hobbies in one (comma
separated, I assume) field.
Set up an association properly, and have done with it.

> all checked values for that i am using below tag,but not working,please
> any suggestion
>
> the above check boxes ,i want in registration,validating and mainly
> editing i want how to possible

If you insist on implementing your horribly broken solution to the
problem, then you'll need some helper methods in your model that take
your single column and break it into an array, and take an array of
ids (from the params array in the controller) and join it back into
your field, such as:

  def hobby_ids
    self.hobbies.split(",")
  end

  def hobby_ids=(supplied_ids)
    self.hobbies = supplied_ids.join(",")
  end

No-one is going to "help" more than this, as the correct solution is
to "make an association", anything else is a hideous bodge that is
going to lead to heartache and worry.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to