Thursday, December 18, 2014

Learn Rails Tutorial started!

I started Daniel Kehoe's Learn Rails book on Tuesday.  I'm excited to do this tutorial!  I decided to do it before starting Hartl's Rails tutorial to get more practice and because the application I will be building during the book will be suitable for a small business... it includes contact form and mailing list features.  This will be great since the first independent project I'm going to take on is making a new website for my dad's business!

I got through chaper 12, setting up my new project and getting git setup along the way, and then got stuck for hours on the dumbest mistake ever.  I'm pretty embarassed that I wasted my evening on such a silly error.  I was editing my .bashrc file and secrets.yml file in the app to setup environment variables in the bash file so they aren't revealed in the secrets.yml file.  I kept getting one of two errors:  my secret_key_base wasn't defined in the secrets.yml file and an error similar to this one: "ruby/2.1.0/psych.rb:370:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 18 column 1 (Psych::SyntaxError)"

After systematically going through replacing variables in secrets.yml file with hard values, checking the multiple bash files on my computer for conflicts (bash_profile, bashrc, profile, zshrc, etc), I finally found the problem and felt so dumb.  When I was opening up my bash files, I was just clicking them in Finder and the default textEdit program for Mac was opening them instead of opening them in my text editor, Atom.  So, the problem was, that the textEdit program was adding formatting that couldn't be interpreted properly by my computer.  DUMB!  Once I went through them and re-did my bashrc file in Atom, it all works!

I could continue to beat myself up for making this mistake, but it is better to laugh at it and learn, and never make it again!