New to ruby on rails, so I hope this isn’t a stupid question (great way
to start a post ;)). Basically I’m trying to avoid making a bunch of
different columns in my db table by having my collection_select
concatenate the ID value it returns to a single text field (for
instance, the collection_select will return a footnote ID, and I would
like to keep it in a job column called footnote) with comma’s in between
because each job has multiple footnotes.
Is there any way I can accomplish this ? Ideally I would like to put
comma’s in between so I can break it apart in another area of my
program.
New to ruby on rails, so I hope this isn’t a stupid question (great way
to start a post ;)). Basically I’m trying to avoid making a bunch of
different columns in my db table by having my collection_select
concatenate the ID value it returns to a single text field (for
instance, the collection_select will return a footnote ID, and I would
like to keep it in a job column called footnote) with comma’s in between
because each job has multiple footnotes.
DO NOT DO THAT. You need two tables with a has_many/belongs_to
relationship. You should never ever put multiple values in one field.
Is there any way I can accomplish this ? Ideally I would like to put
comma’s in between so I can break it apart in another area of my
program.
Don’t. Read up on proper database normalization, and do it right.
New to ruby on rails, so I hope this isn’t a stupid question (great way
to start a post ;)). Basically I’m trying to avoid making a bunch of
different columns in my db table by having my collection_select
concatenate the ID value it returns to a single text field (for
instance, the collection_select will return a footnote ID, and I would
like to keep it in a job column called footnote) with comma’s in between
because each job has multiple footnotes.
DO NOT DO THAT. You need two tables with a has_many/belongs_to
relationship. You should never ever put multiple values in one field.
Is there any way I can accomplish this ? Ideally I would like to put
comma’s in between so I can break it apart in another area of my
program.
Don’t. Read up on proper database normalization, and do it right.
In connection with this, and at the risk of reviving a dead thread: a
big part of database normalisation is atomising your data. This enables
you to better acclimate your application to future alterations and more
effective database requests. Searching is a good example of this - I am
simply reinforcing Marnen’s point regarding database normalisation.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.