Help with the iOS on Rails book, various questions

Hi there, I was guided here by the following comment on reddit ( ), and have a question/comment or two about the book.

In the first chapter, when I run

bundle exec rspec spec/

I get

/Humon/spec/controllers/events_controller_spec.rb:3:in `<top (required)>’: uninitialized constant EventsController (NameError)

I’m assuming this is because the events_controller was moved from app/controllers/ to app/controllers/api/v1/events_controller.rb

How can I get around this?


It looks like this book is fairly new, based on the March 19 2014 timestamp at the start of the book. I wanted to leave a comment on the book, not as some kind of scathing criticism, but as a helpful criticism from the beginners point of view, that may help alter future versions of the book.

Creating any book is a fine balance between defining the target audience, and including just the right amount of domain knowledge for that audience.

Imagine I created a book on simple maths. I begin the first chapter, the books only chapter, with many equations like the following…

(5 + 10) * 2 + 5 / (10 - 5) = 31

A book like this would useless to those with lots of knowledge on the subject. Teachers for example. Let’s take the other side of the spectrum, those who know nothing of the subject. If you gave this to a child without education in maths yet, they would be dumbfounded. What is this + symbol? What is -. Until they have the domain knowledge of plus, minus, can they even begin to think about multiplication and division, or order of operations. So this book would lack the ability to reach either audience. The only ones who would appreciate it are those who know the basic operations, but want to learn order of operations only. This book could reach a MUCH wider audience if it gave a simple run down along the way of simple operations. Not much more than a few pages are required, and all of a sudden the book just multiplied it’s audience by 100.

The iOS on Rails book to me is falling a bit in that category. It has all the final code to complete the job… but it assumes, IMO, way too much domain knowledge. Those already heavily involved in Rails are like the Teachers in our example. They likely are capable of doing this themselves, or figuring it out quite easily. On the other hand… those will little knowledge are left looking at our equation dumbfounded at what + means. That’s where the balance must come in. This book can’t be an all in one book, teaching the basics of the conditional operators to people, and what a variable is, etc. However, it is lacking some domain knowledge, that could so easily be put in here and there in a sentence or two to elaborate on things. Including the ‘rails generate model Event…’ line would have been but a few handful of words, no more than 2 line of the entire book, yet omitting it is detrimental IMO. I know what FactoryGirl is thanks to the Hartl tutorial, but this book (first chapter) makes reference to FactoryGirl without even a sentence or word on what it is.

I feel like this book is targeting a very small audience. One not knowledgeable enough yet in Rails to know it, yet also not new enough. It’s a very small subset inbetween of those who have done a fair amount in Rails.

This book likely targets iOS devs more than it does Ruby devs. It’s likely a market for those iOS devs who are curious about using Rails for a backend. That means the target audience likely has a good amount of iOS domain knowledge, but little in Rails. IMO, the domain knowledge assumptions in this book could and should be made for iOS, but for Rails, much more is needed.

I’ve done Rails for Zombies, Michael’s Hartl’s tutorial, I’ve been playing around with Models now for days, making my own little simple models to fully ingrain everything, I’ve read all the guides on the the Rails website… I feel at this point I should absolutely be ready to work my way through this book, and yet it still asks of me to have more domain knowledge. I’m still not in the very small subset of people who would find this book helpful yet.

Did you ever figure out what would be causing this? I’m running into the same problem but my folder structure looks correct.

You should namespace your controller, like Api::V1::EventsController, instead of EventsController.