Starting with Rails

One thing that really troubled me when trying to get my site to run on an actual live production, was understanding which gems and services etc. that were relevant for me. I found lots of tutorials and guides, but they always seemed to cover something that was slightly different than my setup.

This is an over view of the different parts that you need, when you want to run a Ruby on Rails application, and their different variants. The top most row is what I currently use.

Rack server Web server Database
Unicorn Nginx PostgreSQL
Puma Apache MySQL
Passenger
Thin
WEBrick* SQLite*
  • These are for development

DISCLAIMER: I'm writing this to understand it myself. If you see something that's clearly wrong, please let me know @floede

The point is that if you read a guide that assumes you're using Passenger, but the server you have uses Unicorn, you'll know that these two handle the same tasks, and you'll only need one of them.

Links

ruby-toolbox.com/categories/web_servers

stackoverflow.com/questions/4113299/ruby-on-rails-server-options

Starting with Rails

I had been interested in doing more than just HTML and CSS for a while, and when I got an idea for a serious website I wanted to build, it seemed like the time was right.

Some time before, I had read about Ruby on Rails, and how it makes it easy to create a website from the ground up. I had just not gotten around to actually trying it out. I didn't really have a reason to, as I've been working on Windows based platforms my whole career.

I started reading a few simple guides, and took some online courses like Rails for Zombies and tryruby.org. Subscribed to /r/ruby and /r/rails. I read quite a lot of Why's Poignant Guide to Ruby, which both amused and annoyed me with it's quirkey sillyness.

It didn't really teach me a whole lot. I'm probably not a programmer, and I have no understanding of what makes Ruby better than other languages. Or not. Making small code examples with math or logic that differs slightly in syntax from Javascript, but otherwise does nothing, teaches me nothing. I need to make actual projects, to make things stick in my mind.

Then, because I was looking for ways to get into Ruby on Rails, and because Kickstarter was the new hotness, I came across the Learn Ruby on Rails book project from Daniel Kehoe.

Then when the book came, I read through it first, and then I started coding. That was a year ago. And suddenly I had functioning Rails code running on my computer. Now I have a real website running on a server, with a sign up form and simple functionality.

I'm pretty sure, that without Daniel's book. I would never have made it this far. Not only do I return to it regularly, to look up details, but it also taught me basic things about developing web sites that I didn't know, even after working with it for 15 years.

Links

railsforzombies.org

tryruby.org

mislav.uniqpath.com/poignant-guide/book

guides.rubyonrails.org/getting_started.html

skillshare.com/classes/technology/Ruby-on-Rails-in-30-Days ...

Solving Jekyll for GitHub pages on Windows

Trying to work with Ruby (on Rails) on Windows is often a pain in the neck. So much so that I'm actually running Linux through Vagrant on my home computer.

But setting up this very blog couldn't require much I thought. I was so wrong.

With Jekyll you're encouraged to install the gem locally, and run a local Jekyll server to write and test your pages.

I followed the instructions from juthilo, this was working fine for me, but I just couldn't get the files to build properly, once I pushed them to my GitHub repository. Even though I changed nothing in the original files that comes with Poole and Hyde, and I could run it locally just fine, I kept getting errors from GitHub.

Then I found this guide from Eric Trinh detailing how you should aim to replicate GiHub's setup locally. This meant manually installing a ton of gems. Luckily Ruby tells you which and how.

However I kept getting errors that Jekyll couldn't load the syntax highlighter Rouge.

cannot load such file -- rouge

I tried re-installing and updating. Nothing helped. Finally I caved in, and tried the other highlighter mentioned by juthilo . Which required me to install Python. Working with modern web applications often feel like jumping into the rabbit hole. One gem requires another gem which leads to a third, and so on. Same goes for node packages really.

But after installing Python, and switching to Pygments, I was finally able to make it work. And you're able to read this.

Links

http://jekyll-windows.juthilo.com/

http://erictrinh.com/blog/jekyll-and-gh-pages/

Very first problem

Strangely jekyll serve makes the server crash. No errors.

I'm writing this on Windows 7. While not recommended, I'm taking my chances and I've had no problems as such setting up Jekyll on this machine.

However today, the local server just stops working.

After reading a couple of StackOverflow posts, I tried downgrading to Jekyll 2.1.1. It solved the problem, but also removed the "watch" feature, which I quite like from Grunt.

Tried running jekyll serve --watch and the problem returned.

So apparently there's some problem with the watch task - probably because I'm on Windows.

The obligatory

The first post in my new life as a Ruby on Rails developer!

I've been toying with building a website for some time. I'm using Ruby on Rails, because it seemed like the easiest way to build everything from scratch and get something up and running quickly. While at the same time, offering more options going forward, than your average Wordpress installation would.

This blog is meant to be documentation for me, but also a way to learn more about what I'm doing, by writing about it. I'm terrible at remembering code, and why this work and that didn't work. Writing it down will help me in two ways.

And if anybody drops by, and learns any thing - or has comments for me - that'll just be a bonus.

j