A Rails Beginner Cheat Sheet

Hi everyone,

during the last week I spent a large amount of time creating a Cheat Sheet for Rails beginners! So, here it is: http://pragtob.github.io/rails-beginner-cheatsheet/

I originally started creating this cheat sheet for my awesome Rails Girls Berlin project group. But I figured and hoped that a lot more people would be interested in this 🙂

So far this cheat sheet covers the following aspects:

  • Command line basics
  • Ruby basics including (Numbers, Strings, Arrays, Hashes)
  • Rails basics including a description of the folders and commonly used commands (like starting the server)
  • Tips about using an editor
  • Information about where to get help

So also feel free to check out the repository and especially the open issues – I would love feedback on many of them! And contributions are also very welcome!

Cheers, hope it helps you + keep on learning,


Teaching a course about web development at Humboldt University

Hello everyone,

just a quick note but I’m extremely excited to finally announce that I will be teaching a course about the basics of web development at Humboldt University Berlin. The course is meant for bachelor students who don’t study computer science. It’s a total basics course, no prior knowledge required. The course will start with basic HTML and CSS, then we’ll get into some Ruby and then some Ruby on Rails. So in short, it could be perfect to be the start of your journey into Programming. And a useful skill to have, in the spirit of this awesome video.

The course will be every week on Wednesday for 9 weeks (starting in May) for ~5 hours + breaks. The course will be held in German. The course is limited to ~14 students.

Link to the full course description (German)

If you are a student interested in the course, feel free to get in touch with me for questions etc!

In the end, a big thanks to everyone who helped making this happen! Especially Dajana 🙂



Slides from the Febuary 2013 Rails Girls Berlin workshop

Hi there,

So here are the slides from my talks from the Rails Girls Berlin workshop on Saturday, in their chronological order:

Introduction to web applications (the one with the map)

I love programming

The slides are Creative Commons Attribution license – so feel free to share and modify them but say where you got them from 😉

And as a little bonus I was allowed to post the beautiful Rails Model View Controller comic drawn by Anja of our Ruby Monsters project group – the comic is Crative Commons as well if I understood her right!




(green) Tobi

Slides: Introduction to Web Applications (RailsGirls Berlin)

Hi everyone,
here go the slides from my talk this morning at the RailsGirls Berlin December workshop. It’s a basic introduction to web applications and Ruby. Enjoy it and feel free to use it everywhere – if you got questions comment 🙂

So enjoy RailsGirls and enjoy coding! Hopefully see you around for the afterparty and feel free to grab me any time if you want to ask me something or just chat!



Podcast: Ruby lernen

Hi everyone,

at first sorry to my English readers but the remainder of this post will be written in German! This is due to the fact that this post is about a german podcast. I promise to write a blog post about learning Ruby in English in the future 🙂
German part of post:

Hallo alle zusammen,

vor einigen Wochen wurde nun der Podcast veröffentlicht bei dem ich mich zusammen mit Jan Lelis über das Thema “Ruby lernen” unterhalten habe. Der Podcast geht 72 Minuten und ihr könnt ihn euch hier runterladen. Im Podcast erfahrt ihr unter anderem warum man gerade Ruby lernen sollte, Hinweise auf Lehrmaterial werden gegeben, es wird viel über Ruby und Lernen generell geredet und ein bisschen was über mich erfahrt ihr auch noch 😉

Eine kleine Ergänzung gegenüber des Podcasts habe ich noch. Ich habe inzwischen noch eine gute deutsche Ressource zum Ruby/Ruby on Rails lernen gefunden: Ruby auf Schienen.

Für die interessierten Hörer gibt es bei den rubykraut podcasts auch noch mehr zu entdecken: Der Podcast ist noch jung aber es gibt auch schon Folgen zu Syntactically Awesome Stylesheets, dem Framework Padrino und den verschiedenen Ruby Implementierungen!

Viel Spaß beim Hören, Feedback ist wie immer willkommen und sorry für die verspätete Meldung, ich war gesundheitlich etwas angeschlagen.


Setting up PostgreSQL for Ruby on Rails on Linux

So every once upon a time I run into the situation, that I have a newly set up machine and have to configure my system again to use PostgreSQL and play nicely with Ruby on Rails. And I don’t want to have to google the set up every time, hence this post (and of course to help people with similar problems). Why PostgreSQL? Well many people like it and you need it for instance for deploying on heroku and your development environment should be as close to your production environment as possible.

What I do here is a way that works for me on my Linux Mint Debian Testing machines. Be aware that this is my development set up – I don’t use this in production.  I’m no PostgreSQL expert so, this just works for me and I hope that it will for other people as well :-). Suggestions/Improvements are welcome as always.

Let’s get started! So at first we have to install PostgreSQL:

sudo apt-get install postgresql

After we’ve don this we need to create a user in PostgreSQL. So we use the user account of PostgreSQL to create a user with sufficient rights. I just take my own account and grant it sufficient rights with PostgreSQL. Don’t forget to substitute my username with yours!

tobi@speedy ~ $ sudo su postgres
[sudo] password for tobi:
# the behavior of createuser seems to have changed in recent postgresql versions
# So now do the following (-d says allowed to create databases):
postgres@speedy /home/tobi $ createuser tobi -d # replace tobi with your user acc name
# In older versions it used to work like this:
postgres@speedy /home/tobi $ createuser tobi # (substitute with your username)
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

At this point it would be good to install the pg gem – which is the adapter for the PostgreSQL database. So simply add

gem 'pg'

to your Gemfile. Also make sure to replace existing database gems – like sqlite. Now run:

bundle install

to update your dependencies. That should go smoothly, otherwise you are probably missing dependencies.

Now you still need to modify your config/database.yml. Most of all you need to change the adapter to “postgresql”. Here is the development part of my database.yml for reference:

  adapter: postgresql
  database: ArbitaryDatabaseName
  pool: 5
  timeout: 5000

Make sure that the different environments (development, test and production) have got different databases (meaning the database property should be different). Otherwise they will influence each other and you don’t want that.

In order to finish the set up you need to create all the databases, which should work flawlessly by now:

rake db:create:all

When this is done you should be able to “rake db:migrate” your database as you are used to (and be sure to do so).

I hope this post helped you with setting up PostgreSQL for Ruby on Rails on Linux. If something didn’t work for you, you feel that a step is missing or you just have a useful tip – please feel free to comment!

4 lessons learned from teaching at Rails Girls Berlin

This is just a little post recapping some of my experiences from the last RailsGirls Berlin workshop. By the way, we’ve got a new workshop upcoming this Friday and you can still register! Most of this is a reminder to myself in order to be an even better coach at our next workshop 🙂

1. irb can be great for teaching – but confusing as well

I love irb for teaching. You can show many things quickly and instantly. And you get feedback. You can play. It’s awesome.

However, especially for real beginners it is kind of confusing, even more so if it is the first time that they work with a console. So it’s hard to distinguish what irb is and what the normal console is. In a later mentoring session I also had someone who disliked irb as a whole and rather wanted to write a real program with real files. Everybody likes to learn his/her own way 🙂

However my main take away with irb is the following: Be aware of the nesting! And by that I mean missing parentheses and keywords! You know the result: irb is waiting for the matching keyword/parenthesis. Beginners often don’t notice this and are just wondering why it isn’t working and behaving like with all the others. During our introduction to Ruby this was one of the most common blockers I saw, especially when we started working with blocks. So to get them out of this: Ctrl + C

2. Restart the server after installing a new gem

We all know this one. In order to pick up on some changes the rails server has to be restarted. Although when you’re teaching multiple students it’s sometimes hard to remember. So if a step involving a new gem isn’t working make sure it is installed and restart the server.

3. Save the damn file

Yes save it. Please do. I know it’s the simplest thing in the world but we are sometimes so used to saving our files that it doesn’t even come to mind anymore. I once spent 15 minutes discovering that an unsaved file was the cause of an error. Before that another coach had already spent ~30mins on the same problem. We checked everything until we noticed the little star next to the file name in the tab bar. Then we saved the file, which we had previously looked at like a million times, and everything went well.

4. Explain, but simplify

Explain what which part does but don’t aim for perfection or total correctness. In other words: Lie to simplify. Focus on the most important knowledge. I gave very short introductions to the MVC-pattern (while looking through the code) and refined them until the student seemed satisfied.

And don’t omit the explanation. I know that Rails involves a lot of magic and it might be hard to explain, however I heard from some students that nobody explained the distinct roles of the model, the view and the controller to them. They didn’t know what happened where. This left them really dissatisfied. They’ve built this awesome thing but had no idea how it works.

I hope that these tips might be helpful for you when you are coaching. There are probably some more of these to come after the next workshop 🙂