Ruby datamodels
Wed, Nov 29, 2006
Today we looked at creating a datamodel in Ruby on Rails. We created a simple database for storing todo items for a project. We only looked at creating the model, not at creating a view for it.
The presentation I used:
In the demostration we build a small application for managing tasks in projects. The datamodel in words:A user can be in many projectA project can have many users
A project consists of tasks
A task consists of subtasks
The work of the demostration can be downloaded here: Example
Notes:
- Look at the testcontroller in the app/controller directory for some examples of how simple and powerful ruby is at managing database relations.
- Look in the app/model directory
- Change database.yml for your own database config
- SQL file can be uploaded in your mysql database to create the database tables.
Material I used for today’s session:
- More on describing relations link
- Active record documentation
- Agile web development with Railslink
Popularity: 5% [?]

November 30th, 2006 at 1:47 am
Well the ‘workshop’ was really at the right time. We can now start creating the database for our main app. We were having discussions within our group about the relations between data and how the database eventually should look like. In this workshop we learned exactly how to create relations and start laying the base for our app.
Well now we would like to figure out how to pull Flex over the Ruby framework, just like a warm blanket which feels nice and comfortable.
November 30th, 2006 at 9:38 pm
A very nice step-by-step tutorial it was. We built something similar before with help from Andreas Lindeboom, however this is more complex. It definitely gave me a better understanding of the power Ruby has (e.g. the validators and relationships). It’s amazing to see how fast someone can build a small and simple text editor with a database connectivity without using a traditional SQL query;
User.find(1)
vs.
select * from users where id = 1
Before moving onto Flex, I’d like to see a more finished taskmanager. A text-based task management system (or whatever you want to name it). Of course it would be very nice to see the final product using the Ruby and Flex combination.
Nice work Raymond, thanks.