Walking on Rails

- -

To anyone experimenting with Ruby on Rails, I highly recommend starting with a domain model and a debugging session. Knowing how to create and associate elements in your model lends a lot of focus to how you’d like to write your views.

To do this, there’s only one real deviation from the video here. You now have a script command ready to do the task for you.

ruby script/console development

or its cousins will let you instantiate objects, assign their properties, and save them. It will also let you know about syntax errors, missing columns, or misnamed columns in the most direct way possible. After a walk through your model in irb, you should feel confident about constructing the view in a similar way.

I think this representation of the association directions can help. Note, though, that belongs_to seems to be simply a bidirectionality tool; It’s not required for has_one to work.