I’m finally starting to understand Rails! :)
Now that school’s out I don’t have any homework breathing down my neck, so this morning I got up early and decided to write a Rails app that takes a GEDCOM file (using an existing GEDCOM-to-XML parser) and imports it into a Beyond database.
Instead of using the traditional scaffolding (which is the easy way to get started with Rails), I decided to go it on my own, creating the necessary models and controllers and views through “script/generate,” and then link them together. In the process, I’ve learned a lot about how Rails works. The whole MVC thing makes sense now, and I see how I can stitch the pieces together to get what I need.
About the only real difficulties I ran into were from naming fields “key” and “object_id”. I wish there were a document somewhere that told you what field names to avoid. There probably is and I just haven’t found it yet. Anyway, after a while I realized that “object_id” was a Ruby method and rel.object_id was giving me a long funky number because of that and not because something was wrong with the database. So that was nice.
Oh, and I discovered config/routes.rb, which answers a lot of the questions I’d had about URL mapping (i.e., where the “/controller/action” URL actually comes from, and how Rails knows about it). Very cool.
Anyway, I’m really, really glad I’ve gotten past the initial bump in the road. This is where the fun begins. :)
[tags]Rails, Ruby on Rails, GEDCOM, Beyond[/tags]
Throw in your two cents