The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Brett Sanders (8) [Avatar] Offline
Resolved the Issue : Need Help >> Stuck on chapter 9.2, 9.2.1, and 9.2.2
Not sure what I did, but all tests were passing fine heading into 9.2 - 9.2.2 ...

However, when running
bin/cucumber features/creating_tickets.feature on page 226, I get 2 failures on

Scenario: Creating Ticket
And I press "Create Ticket"


Scenario: Creating a ticket with an attachment
And I press "Create Ticket"

I'm getting the same error at stop of trace for both scenarios ...

undefined method `display_name' for #<User:0x007f807977bbd0> (ActionView::Template::Error)
.../.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in `method_missing'

The trace is of course much longer, but I'm not sure what else may help from the output.

I've double checked my code for this chapter as well as checked my code against the final code for the book and don't see where I went wrong.

If anyone has any suggestions on how to troubleshoot this, it would be much appreciated. Thanks!


I was able to resolve this issue by reverting back to the previous commit, when tests were passing. In case others run into similar issues and need to backtrack, here's what I did:
* * * * * * * * * * * *

At page 220, end of chapter 9.1.3, all my tests were passing after running

rake cucumber:ok spec

I then committed (actually, ammended the commit) and pushed

git rm public/system/assets/1/original/speed.txt
git commit --amend -m "Added the ability to attach a file to a ticket"
git push

I then followed along through chapters 9.2 - 9.2.2

A few steps along the way, I noticed a few errors that differed from the books. I didn't think much of it, since they didn't seem too off track.
When I ran my tests at end of chapter 9.2.2, I got 2 errors on the "Create Ticket" steps
Uh oh …

So, I wanted to start over at my last commit. The question was HOW?

Given I made changes to the DB and created new files and a model, a simple
git checkout wasn't going to work …

So I got some help and did the following:
git checkout
git status
noticed that the status wasn't clean, there were still "changed not staged for commit" and "untracked files", so, I then ran

git reset --hard

( I could have run git add . && git stash, but given I was going to rework through the chapters and wanted a real clean slate, I had no reason to stash my former mistakes)

At this point, there were still "untracked files", so I ran
git clean -f

I then ran
rake db:reset RAILS_ENV=test && rake db:reset

At this point, I was back to my earlier commit with all the changes to my db reset to the earlier version as well.

I then went back through the chapter very carefully and everything passed. Nice.

Message was edited by:
Brett Sanders
ryanbigg (423) [Avatar] Offline
Re: Resolved the Issue : Need Help &gt;&gt; Stuck on chapter 9.2, 9.2.1, and 9.2.2
Where is display_name coming from? Do you have the code on GitHub somewhere that I can look at to double check this?