Got My Ruby on Rails Question Answered for $5

So after a week of trying to implement a feature for my Yelp clone project, I finally caved and decided that I needed some extra help. I contacted a few folks on Reddit and Codementor, but ultimately didn’t receive any responses. Elance would’ve been a little much since I had a simple question. The next local Meetup is 2 weeks away and I didn’t want to wait any longer. So, in desperation, I resorted to trying to find someone on Fiverr again.

My experience with finding someone on Fiverr hasn’t been negative, but it wasn’t exactly positive either. If I had to rate it out of 10, I’d say it was a 4. But, I was desperate and decided I’d try it again. I search for “ruby on rails” and was brought to the “High Rating” gigs. I decided I’d try something else. I wanted new blood because I’ve already contacted a few of the folks before and they either tried the bait-n-switch (posting a $5 gig but saying it’ll take 10 gigs) or I used them before and they weren’t much help. This time, it was definitely a success.

Now maybe it’s because what I wanted to do was very simple and I just needed to know the syntax, but the new person I found responded within minutes and even had the solution within an hour. I basically wanted to be able to capture a visitor’s location and show them a model within X amount of miles. Instead of throwing some syntax for me to try, they actually pulled my repo and made a pull request, comments and all. It wasn’t exactly what I wanted, but I could take what they did and apply it. For $5, I couldn’t have asked for more. Also, they said they’re more than willing to help me if I have anymore questions in the future and to just email them.

Learning Rails on a budget is definitely a slower pace, but I think I’m getting the most bang for my buck. One reader contacted me and gave me their experience with Bloc.io. I’m glad they did, because I contemplated using their services but couldn’t justify the $5k price tag. And from what they were saying, it might not be worth it. But maybe I’ll save that for a later post. Happy Halloween!

Thoughtbot’s Upcase Review

So after a week of going through Thoughtbot’s Upcase program, I’ve decided that it wasn’t for me. There was definitely a lot of useful information, but it seems like the service would be a much better fit for someone who already knows Ruby/Rails and is looking to get a deeper insight to the intricacies. Personally, I think an intermediate level developer would benefit most from Upcase, not folks like me who need their hands held every step of the way.

Tutorials
There are two Ruby on Rails tutorials. The intro tutorial goes through a simple card type app where you can build a deck of cards and the intermediate one builds a Twitter clone app with TDD. While both tutorials were in-depth and covered the basics, I didn’t feel like there was a lot of value. The deck app was simple enough where you could probably figure out how to put together yourself if you scoured Google and the Twitter clone was a duplicate of Michael Hartl’s tutorial. To their credit, these are great tutorials with great explanations, but probably not ones I’d pay for.

Trails
They have various “Trails” that are essentially paths to help you better understand a specific skill at hand. So they have a Ruby trail, Vim trail, Rails trail, etc. These trails may have one or two Thoughtbot video tutorials, but for the most part, it points you to an outside reference. For example, the SQL trail doesn’t have any Thoughtbot created content. All their references are pointed to an outside resource. While this does save you the time of going out and finding the sources yourselves, I don’t think it’s worth paying for. It’s great they laid out a plan to help folks get an understanding of what they might need in order to land a job as a developer, but what you could have found everything you’ve been given if you just ran a search on Google.

Weekly Iteration
The weekly videos they release every Friday are definitely interesting to watch. They go through various Ruby related concepts and discuss technology in general (Law of Demeter, Sandi Metz’ Law, dependencies). Again, this is where I believe an intermediate Ruby/Rails developer would benefit from most. As a beginner, these concepts and talks go over my head. When they start getting into extracting classes and refactoring code, although I know what they’re talking about, I can’t value the discussion as much as I should because I have no real context. There are definitely some videos that anyone can benefit from, like how to land a Rails job, but from a beginner perspective, I can’t fully appreciate what they’re talking about.

Exercises
Another section where I believe an intermediate developer would benefit from most. There are great exercises that they release on a weekly basis, however, as a beginner, I really have no idea what I’m doing. When asked to write a test for a particular method, I’m not quite sure where to start. How does this differ from the other, free exercises like exercism.io or Ruby Koans? I think the approach would’ve been great if they gave an exercise, then walk you through finding the answer. I get that they’re trying to push subscribers to use critical thinking, but it just becomes frustrating when you have no idea what you’re doing (which is why you’re there to begin with).

Repositories
They have three repositories that you have visibility in to: the Upcase application itself, the application they’ve built for their exercises, and Payload (which I’m not quite clear what this is). They are all full, heavily tested applications. It’s a great insight into how a production level application is structured. Being able to go through all the files and code, it really opens your eyes and sets the precedence of what to expect if you land a job as a Rails developer. If only I knew how to read the code so I can understand what’s going on. Again, this is where I think someone who has a strong grasp of Ruby/Rails will benefit from most. As a beginner, it’s just scattered letters and symbols.

 

It may sound like I’m being highly critical of their service, but it’s my personal opinion. After a week of playing around and going through most of their material, I didn’t find myself constantly coming back to Upcase. I strongly believe this is the best monthly subscription service out there. And if I feel like I’m not getting a lot of value here, I can only imagine what the hundreds of other services are like.

I find it hard to believe that there isn’t a better learning program. As I’ve said before, maybe you get what you pay for? After going through a program created by highly regarded Rails developers and feeling like I’m not getting a lot of value, do I really want to make the jump to a Bloc.io or CodeSchool. What I want is simple: walk me through building a semi-complex app from scratch. Start from “rails new <name>” and show me the entire process, including TDD. Hartl’s tutorial is a great starting point, but I want more functionality. Show me a Facebook/Quora/Yelp/Groupon clone that includes full text searching, geolocation, and administration management.

My quest to learning Rails continues. As always, I will report back on my progress and will review any resources I’ve tried.

Upcase by Thoughtbot

I finally caved and decided to subscribe to a learn-Ruby-on-Rails service. However, I strongly believe that I chose the right subscription. There aren’t many reviews, I think partly because they don’t advertise it nearly as much as others, but Upcase is Thoughtbot’s service to help beginners learn Ruby/Rails. I’ve mentioned them before, but if you don’t know who Thoughtbot is, they’re basically a highly regarded Rails/web development shop. They’re known for their apprentice program and have many gems that you’ve probably used before.

They recently got rid of their $99/mo tier and brought it down to $29/mo. I think that’s a steal because now you’ll have access to all their video tutorials, the repository for the entire Upcase application, and the various coding exercises that are meant to help keep your brain fresh with user-submitted methods. I’ve just subscribed, so I’m currently on their first Rails trail. I’ve been following along with the videos, so when the instructor is coding, I am too. The greatest part is that this is a subscription, so you can cancel at any time. With these types of services, I always recommend going through as much and as fast as you can to maximize the learning at a lower cost.

As far as I can tell, it looks promising. I’m excited for the weekend because I’ll have the time to run through the different trails and hopefully learn a lot along the way. I’ll report back and do a review of their service once I’ve gone through most of it.

Learn Ruby on Rails Book

I’ve been given a copy of “Learn Ruby on Rails”, created by Daniel Kehoe, and am excited that I’ll be going through it in the next few days. I haven’t had much time to take a deep dive, but from my initial glance, it seems like the book itself is geared towards complete beginners. In the first initial chapters he states that the book is meant to give a high level overview of Rails and will skip over all the other intricacies that would normally cloud and confuse beginners (TDD, IDEs, etc.). And as I’ve mentioned in previous posts, that’s definitely the path I recommend.

I’m impressed with what I’ve seen so far and will be going through it in its entirety, book as well as the various tutorials. There only seems to be 3 tutorials outside of the book itself, but we’ll see what application we actually build in the book. I’m a big fan of building real world applications, which is why I favor tutorials.

Review of the book and the entire RailsApps Project coming soon!

Thoughts on Vim for Rails Development

Most new Rails developers (including myself) follow a very systematic process: install RVM, install Ruby/Rails via RVM, download SublimeText as your editor, and start following Hartl’s tutorial. That’s not a bad process to get started, especially if you’re completely new to development. I stayed on that path for a while because my first and foremost goals was to learn Ruby/Rails. But after you’ve gone through enough tutorials, start working on your own project, and start scoping out potential employers, that probably won’t cut it. After my continuous digging of resources, I stumbled on Thoughtbot’s blog and their Upcase subscription service. For those of you who don’t know who Thoughtbot is, they are a highly regarded Rails/Web/Mobile development shop. They have many different gems out that most of you have probably used (Paperclip and Factory_Girl come to mind). After browsing their material and what they’re all about, one thing comes up more often than others: Vim.

Vim, in the context of what I’m going to talk about today, is essentially a text editor (like Sublime, TextMate, Notepad++). It’s what the hardcore developers use as their editor. Some of the reasons:

  • Higher efficiency: the entire goal is to keep your hands on the keyboard, along the home row. So instead of using your mouse to scroll around to navigate files, it’s all within your reach with different keystrokes.
  • Configuration: Vim comes with a plethora of configuration options via .vimrc. This is where I got lost. There is a sea of plugins that you can use, so no two Vim editors will be the same (almost). You have different color options, window pane views, and I think there’s even an auto correction plugin.
  • Hardcore status: this is my own subjective opinion. It seems to me that Vim is used by the more seasoned developers, thus giving (at least me) the implication that a Vim user probably knows their sh*t.

All that being said, I’ve decided to start using it as my editor of choice. It initially started with me wondering what all the buzz is about. I’m still playing around with it and just got it up and running. I’ll put it bluntly: it is freakin’ hard to setup. It took me 2-3 days to research and get it working with my Rails project. In hindsight, it was pretty straightforward. But I couldn’t find a single resource that started from Point A to Point Z. There were little snippets and tutorials of how to use Vim, but nothing that was concise. Most of the time it was people going over their configuration versus showing you how to actually configure it from the ground up and get it working. I just want to know how to go from not having Vim to getting it looking like <insert developer’s Vim screen>, colors and all!

Why did I make the switch? Well, “When in Rome…” I strongly believe that if you want to become a great developer, you need to follow in their footsteps. So emulating someone’s thought process/habits/etc. will help you become a better developer. Maybe that’s just my own naivety.

All that being said, I’m strongly considering creating a video tutorial. Maybe I’ll call it “Setting Up Vim for Rails from Scratch.” We’ll see. Hopefully it’ll save others the few days it took me to get it setup. Maybe that’s why people stick with the more straightforward text editors? In all honesty, I almost quit Vim after an hour trying to get it set up. But now that it is, I’m excited to really learn and use it. This put a halt to my Rails learning for a few days, so I’m glad to be getting back to that.

Search Your Model Based on Category

For my Yelp-like project, I wanted to be able to search my model based on a category. I tried following the two Railscasts and browsed various solutions, but those didn’t work as I was trying to do something slightly different. My Category was its own model, so when I wanted to search my Vendors, I had to search the :category_id. I spent a week trying to figure out this seemingly easy task. I even had a question out on StackOverflow and was working with a mentor who couldn’t figure it out either. I was stumped until I went to the Rails Meetup and one of the mentors spent 5 minutes with me to give me the correct code.

I could have easily gone with one of the search gems (searchkick, sunspot, etc.), but it seemed like those were overkill. Maybe I’ll use one of those gems in the future, but for now, here’s my code to show how I did it manually. I’ll leave out the styling so you can see the straight Ruby.

vendor.rb (model I want to search)

def self.search(params)
  vendors = Vendor.where(category_id: params[:category].to_i)
  vendors = vendors.where("name ilike ? or email ilike ?", params[:search], params[:search]) if params[:search].present?
  vendors
end

vendors_controller.rb

def search
  @vendors = Vendor.search(params).order("created_at DESC")
end

layouts/_search_form.html.erb (rendered this in my other view)

<= form_tag search_vendors_path, html: { class: "row-fluid" }, method: :get do |f| %>
  <%= text_field_tag :search, params[:search] %>
  <%= select_tag :category, options_for_select(Category.all.map{|c| [c.name, c.id]}) %>
  <%= submit_tag 'Search' %>
<% end %>

List of Resources to Learn Ruby on Rails

With the popularity of Ruby on Rails, hundreds of bootcamps/courses/tutors/etc. have propped up as the best solution to helping you learn how to build a web application. I’ve been vigorously trying to find a great resource that doesn’t charge me an arm and a leg to learn. As I continue on my path of learning Rails, I am finding it more and more difficult to find a reliable source to teach me how to code. Again, I’m trying to keep my costs low. Maybe the old adage of “you get what you pay for” is very true. Sure, anyone can sign up at Codementor or throw money at gSchool. Money can buy you many things, and learning to code is one of them. But, like most folks, I don’t have extra money to buy myself an education. If I did, I’d get a degree from a reputable university in computer science. At least then I’d have something to show for it.

This is just my opinion, but I don’t believe the affordable resources provide enough value. It seems like they’re all just like you and me: they can scrap things together from the internet and put together a basic app. The Rails community is mostly a self taught one. It’s hard to find someone who actually knows what they’re doing versus one who Google’s their way to building an app (not saying that’s always a bad thing).

Done with my rant. Here is an updated list of resources I’ve used/attempted to learn Rails.

  • Hartl’s Rails Tutorial (Free)
    Great resource for the true beginner. Test heavy, which I don’t recommend doing if you’re a complete beginner like myself. He has a new version out that I haven’t tried, but I’d suggest steering clear of the testing sections.
  • Jumpstart Lab’s Blogger Tutorial (Free)
    Another great resource for a beginner. I actually think this should be the first tutorial you do as it builds a basic blogging app that uses simple relations. I went through this 4-5 times in the beginning just to really learn the syntax. Towards the end, I was able to complete this without having to reference the tutorial, which I highly recommend everyone do. I skipped the Merchant tutorial because it was filled with scaffolds.
  • Agile Web Development with Rails 4 ($45)
    Decent book. Relies on scaffolding. You build a basic ecommerce site with very little CSS. Not the prettiest thing in the world, but it teaches you some AJAX along the way and introduces an algorithm for counting items in your shopping cart. The second half of the book was a huge blur since it does a dive into Rails – ActiveRecord/ApplicationController/etc.. Hard to grasp if you’re new to it like myself. In all honesty, I followed the tutorial once and never went back to it. I wouldn’t recommend getting this book. If you do, get it used.
  • BaseRails ($49)
    At the time, this is how much I spent on it. They were very new, so I bought their Etsy tutorial. They’ve added a Yelp tutorial and a new payment structure. It could just be my ignorance, but it seems like the folks here are self taught. Looks like they were able to Google themselves into building a basic app. At the time of this post, they are now charging a monthly subscription for $25. They’re a little slower on getting up new tutorials. I’d sign up and go through both the tutorials as fast as I can.
  • Elance ($180)
    I found two different people on Elance to help me learn Rails. I have mixed feelings about finding folks on here. Again, I try keeping costs low, so the hourly rate was important when searching for a tutor.

    First person: I think working with someone physically provides a much better learning experience. I found a local developer at $30/hr. I only spent 2 hours with him because this was my first time and wanted to try it out. Very knowledgeable. He had a day job as a Rails developer and had some side gigs as well. Gave me some good advice and worked through an app I had. Introduced me to Rake tasks to generate my dummy data (versus manually entering everything in). He’s a bit out of my price range, but would definitely come back to him for a code review once my Yelp-like app is complete.

    Second person: $20/hr, located in Asia. It was actually great because he was American who moved to Asia, so communication wasn’t a problem. He went to school and seems like he really knew programming. His Rails was all self taught, so a lot of his knowledge was what he found on Stackoverflow/Google. Seems like he could find a solution and hack it to make him do what he wants. Wasn’t a bad gig. He taught me some useful things. Would probably use my first person before using him again.

  • Meetup (free)
    I highly suggest you go to your local Meetups. The one here in Minneapolis is free, but I know some charge a small fee to join. We have a monthly meeting that I try to make, depending on where I’m at for my project. If I’m stuck and have something to ask, I’ll go. The only thing is, there are only a handful of mentors for a group of ~30 people. I really only get one chance to ask one question before I feel like I’m hogging them. Will definitely have someone here do a code review of my app once I’m finished. An added bonus: it gets you involved in the community. The Ruby/Rails community is very tight knit. If you want a job as a developer, might not be so bad getting to know some folks here.
  • Fiverr ($5)
    My experience with Fiverr has been negative. Most people try to do the bait-n-switch. They post a gig up for $5 and when you contact them, they tell you it’ll be 10 gigs to do what you want. I wouldn’t recommend using Fiverr. Again, you get what you pay for. I did get some useful tips from the one gig I bought, which was probably worth the $5, but nothing more.
  • RailsMentors.org (free)
    Another decent resource. It’s hard to find a good mentor though. I try finding one in my timezone and was lucky enough to find someone willing to help. A few others I tried reaching out to never responded and the ones that did said to contact them only if I run into an issue. I was able to find a diamond in the rough, but the caveat is they’re doing this for free. So I have to respectful of their time and if they’re busy, I may wait 1-2 weeks before getting a response.
  • CodeJinn ($20/session. Did not spend money)
    I was disappointed with CodeJinn. Their advertising came off a little misleading. I was going back and forth with the founder on what it is they actually do. When they introduced one free session for new members, I signed up. I was under the impression that they would walk you through your app, with little checkpoints to count as one of their “sessions.” That was not the case. They are basically there to help you get through a bug you’re facing or help give some insight on what you can do for different issues (may not necessarily be helping you code, just telling you where to go for the code). My one conversation lasted 5 minutes.
  • RailsHotline (free)
    I have not tried this yet. Seems like they are going through some technical difficulties (or maybe just lack of traction). Have not found someone online ready to take a call and no update on their Twitter. Hoping they get back online so I can try them out. Looks promising, but I have a hunch they’re like the others I’ve tried.
  • Railscasts (free. Optional subscription)
    Great resource and one that is most recommended. Only downside is that Ryan Bates has stopped producing new screencasts. I still come here for the various things I’m looking to do.
  • GoRails (free. Optional subscription)
    Chris Oliver recently started this screencast series. Looks like he’s trying to pick up where Railscasts left off. I haven’t gone through many of his videos yet only because he’s covering the very basics right now. I’m hopeful this will become a solid resource comparable to Railscasts.

There are many others I’ve tried but without much success, so I didn’t mention them here (Codecademy, Zombies, Appcasts, etc.). Those are all good, but I learn best by building a real-world application. That’s why I favor tutorials over small snippets. Let me know your thoughts if you’ve tried any of these. A lot of the cheaper resources barely scratch the surface of building a viable application. Maybe it’s time I spend huge bucks on Codementor? Who knows. I probably won’t be doing that. I’m going to try a few other things before throwing in the towel and spend my life savings on a proper Rails education.

The Importance of Taking Breaks while Coding

Overcoming a complicated bug or seeing your app finally come together constitutes a well deserved celebration. Now, you don’t have break out the wine and throw a lavish party, but I strongly believe indulging in these small little accomplishments is a healthy practice. When you’ve spent a hundred hours to fix a bug and get the application to function as expected, I encourage taking a small break.

For example, this past weekend I was putting together the styling for my app. I don’t have a creative bone in my body, so I found a theme and started incorporating it. Up to this point, I’ve been neglecting my styling as my main goal is to learn Ruby. I’ve been relying on Bootstrap just as a tool to help make my app a little more bearable. So as I started putting on the CSS files and using the different classes in my views, it was rewarding. I was able to do most of what I wanted to do from a backend perspective, so the fun part of seeing the frontend was exciting. The different layouts and buttons brought my vision to life and was even more encouragement to keep on going.

So what did I do when the main pages and functionality was built? I took a break. After hours of putting everything together and neglecting my family, I closed my Mac and used my free time playing video games, with family, and not thinking about code. Most developers will agree that when you come across a particular bug or add an enhancement, you’re truly not contempt until it’s finished. You’ll spend hours/days/weeks on these tasks, only to have another one right at your door.

I know it’s hard to stop when you’re on a roll, but separate your tasks into small sections. When you complete one, take a break, because I guarantee you that more frustration and long, isolated hours will come.

My Weeklong Issue Fixed in 5 Minutes

Anyone who is self-teaching Rails understands that there are definitely major pain points that can’t be relieved by Google searches or StackOverflow questions. As great a resource as those two are, they simply don’t dive any deeper than junior-level knowledge (in my opinion). Most of the questions on SO are from new learners and most of the blog posts only scratch the surface of the topic they’re covering. The Ruby community is known to be a self-taught one, learning from each other. You won’t find low level classes at any of the colleges or other academic institutions, at least nothing that covers Ruby as intensely as C++ or Java.

All that being said, I thought I had a simple task. All I wanted to do was search multiple columns in one model, by an associated category. I spent a week asking a question on SO and doing all sorts of Google searches. I went through all the gems (Ransack, Searchkick, and Sunspot/Solr). I even tried learning a little more about Elasticsearch, but decided against it because it’s almost another language completely in its own right. For whatever reason, I couldn’t find the solution. Or, if one was presented, it didn’t work.

I spent nearly a week trying to do what was seemingly an easy task. I just wanted to search my model that’s in a specific category! I spent most of my free time, time that I could have spent with family, in frustration. Thankfully, the weekly Rails Meetup was around the corner. Lead by a few savvy Rails folk, I was able to get one of their attention and explained my conundrum. After 5 minutes tinkering around with the syntax, my problem was solved. I was excruciatingly close, but just had to rearrange a few lines of code and add some extra syntax. My week’s long problem just needed a pair of seasoned eyes to take a look at and figure out.

The path of a self-taught developer is a frustrating one. On to the next issue!

My First Stack Overflow Question

After days of trying to figure out how to create a search form that searches a model by category, I finally built the courage to post my issue on Stack Overflow (SO). There are plenty of resources of building “simple search forms” or even “advanced search forms”, with RailsCasts being the number one hit. But, my dilemma is that my root path wasn’t to the model itself. It’s actually pointing to a different controller (in my case, pages#home).

So I played around with all the different tutorials and tried many different solutions. In retrospect, I was actually very close. I was under the assumption that because I’ll be on my “Pages” controller that I needed to put some sort of search syntax there. Instead, I needed to create the search method on my model’s controller and then call it from wherever I wanted (for me, it was pages/home.html.erb).

I won’t get into the details, but it’s amazing that I can ask a question to the general public and someone answers within a few hours. I literally posted my question on SO before going to bed and when I woke up, someone had already answered within 5 hours of my post (thanks @Val!). Now I know firsthand how awesome SO is and why it’s the go-to place for programming questions. I’m just wondering who in the world watches for new questions and answers them in their spare time? I’m guessing SO has some sort of notification for tags that sends out questions to those who subscribe. If not, they should. Maybe someone will create a SO clone, specific for Rails ;)

I digress. In a nutshell, it’s amazing how useful SO is. My only hope is that someday I’ll be able to return the favor when I know enough. Until then, I’ll keep on moving forward with my Yelp clone project and update you all on progress.