I decided to give RoR a try. I don’t quite feel it yet, mostly because I’ve never learned any Ruby. Maybe it’s not the smartest move to learn the framework without learning its mother language, but at least it’s a move.

I opened the official Getting Started guide on my 2.5 hour long train ride and finished the basic “blog” app by ~copy-past~ following the instructions step by step.

On my way back (another 2.5h ride) I decided to start with my own app.

Below are the questions I asked myself during this experiment, sometimes with some answers I managed to find on SO:

  1. Q: How on earth do you know the attributes of the model, if the model class does not contain definitions of possible fields/columns?

    A: You inspect the items in the console with .columns or .attributes, or you write block comments with the database schema in the model class (or use a plugin for that1).

    Sounds… not ideal, to say the least. Most of the fields are going to be mentioned in the class anyway, because of some validation rules, but this is just coincidental. I’ve found attr_accessor that could’ve been used, but it seems that it’s not a conventional thing to do.

  2. Q: Is it common to have models that are not derived from ActiveRecord, so that they do not represent database entities?

    Maybe I do not know MVC well enough.

  3. Q: How to structure Rails app where calendar date is the main view?


  1. Remember to include it in the :development group ↩︎