Topic: Building a Glossary from a Legacy DB
I have to rebuild a simple glossary for a client and am not sure of the cleanest way to do it.
Right now the glossary is built in Textpattern, a PHP CMS which we have outgrown. For the record, Textpattern has quite a few columns in its article table, but all I need are the Title, Body & Section fields to be mapped to :title, :body and :section_id
I know for sure I will need a sections table, model, controller and views. I am also positive that each section has_many :articles and that my articles table will need a section_id column.
The biggest problem here is that textpattern stores the actual name of the section with each article instead of its numerical ID. WIth such a huge inconsistency, I dont know how I can get around assigning the section ids of all 4,000 articles by hand (argh!)
For the sake of positive thinking, lets assume that this is stupidly easy to fix. Once I have imported this legacy data I am then faced with the task of how to structure these sections in Rails, with clean URLs that look like this:
If I am using just one table and mvc for sections, how do I set up my routes.rb file so that certain sections get mapped to certain URLs?