Things are getting more interesting and fun now. I’m almost done with the book from Learn-Rails.Com. I’ve made it to the stage where we are deploying our test app to Heroku, but I’ve hit a small issue tonight that I can’t figure out just yet. I’ll go ahead and post the issue and fix in the next update.

Following along with the book these last two weeks have been pretty good. I did run into a problem the other night that didn’t make much sense to me though. I’ve installed the Better_Errors Gem that replaces the default rails error pages. I’m assuming these will help more once I know what I’m doing, but it actually caused me to run around in the wrong direction recently. I had an error in one of the files within my app’s Models directory. I had an extra space in one line of the code. Watch those spaces! What was odd though, is when you tried to access one of the pages of my app, there was an error, and of course it was a page supplied by the Better_Errors gem. It was telling me there was a “syntax error on line 4” of the Controller file. I read and re-read that line 50 times. Nothing wrong with it! I hastily posted my problem on StackOverflow and was down-voted like crazy because I didn’t explain my question well enough. It was frustrating because I posted the Controller file on StackOverflow because of the Better_Errors page telling me it was in that file. I’m assuming that the syntax error which was actually in the Model file eventually caused a problem with the Controller file, making the Better_Errors gem say there was a problem in that file. I guess?! What saved me was remembering to open up my app’s Logs. You can see errors in there as well. I found the error:

SyntaxError – …/ror/learn-rails/app/models/contact.rb:1: syntax error, unexpected ‘:’, expecting ‘;’ or ‘\n'”.

In the contact file within MODELS. Not in line 4 of the Controller file! Again, I’m assuming it’s just too early for me to know why the Better_Errors gem was telling me to look elsewhere for the syntax error.

Along the way I’ve been returning back to the chapters on the M V C structure for Rails apps. I want to make sure I’ve got it down pat. I’m getting there. It’s slowly sinking in! I watched a great, short Youtube clip from Lynda.com which showed a nice diagram on it. ActionController = Controller, ActiveRecord = Model, and ActionView = View. This helped a lot! Watch it real quick if you’re new to this.

Last week I also went over to TryRuby.org for practicing with Ruby. I’m not as focused on learning it fully yet, but I think it’s a good idea to slowly work through some of the basics as I can.

rails

Hey folks! I ended up going with Michael Hartl’s massively popular (for a reason) Ruby on Rails tutorial course to learn Rails. I highly recommend you do the same.
Check it out here.

2015-07-22T04:33:15+00:00