Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Generate a Scaffold

Chris Gray
Chris Gray
10,305 Points

Rake aborted! NoMethodError: undefined method `last_comment'

Weird error on running rake db:migrate, when I try it I get

rake aborted! NoMethodError: undefined method last_comment' for #<Rake::Application:0x007fe1f29c8cf0> /Users/chrisgray/personal/treehouse/odot/Rakefile:6:in<top (required)>' (See full trace by running task with --trace)

When I run it with --trace it seems to point to the issue being with rspec but I can't find any other occurence of this issue in Rails 4 with google, the only thing I can find are two references to the issue in Rails 2.

I've tried searching through the files to find any mention of the method and nothing comes up.

Hope this helps for a quick resolution as I cannot progress the videos without it.

3 Answers

If this is the same issue I had, you'll have to uninstall rake 11.0, go into Gemfile.lock, go to line 81 and change the rake file version number (I had to change mine to 0.9..6). Hope that helps, damn rake file had me frustrated for a while.

Chris Gray
Chris Gray
10,305 Points

Big thanks this solved the issue

Chris Gray
Chris Gray
10,305 Points

Big thanks this solved the issue

Good work! :smile: :+1:

Joel Buzzanco
Joel Buzzanco
Courses Plus Student 2,738 Points

Hi, I am having the same issue as Chris Gray,

how do you uninstall rake 11.0 ? is it via command prompt? Then you said to change the rake file version to 0.9.6 . I know this may seem like a dumb question but I guess I don't know how to uninstall it.

Chris Gray
Chris Gray
10,305 Points

Joel Buzzanco all you need to do is go to your Gemfile.lock file and find rake in there and change the version number, if you then run bundle install you should solve the issue.

Hi Christopher,

I've never seen that error from that file. However, you're running a migration, so the issue may be lurking within the migration, perhaps?

Can you post your migration file and the current schema, please?

Steve.

Chris Gray
Chris Gray
10,305 Points

Unfortunately this happens even before I generate the migration, if I try rake it also happens, the rakefile is completely untouched.

OK - you said you were running rake db:migrate so I thought there was a generated migration to run.

Chris Gray
Chris Gray
10,305 Points

First noticed the issue after I ran rake db:migrate, suspected I may have done something with the migration so destroyed and reverted back to just after I generated the application and had rspec and capybara installed and ran rake, still face the same issue

Have you tried running bundle exec rake? It's difficult to suggest much if you're at a bare-bones app with just rspec and capybara installed. How much work to rebuild a new app?

Chris Gray
Chris Gray
10,305 Points

Not a huge amount to rebuild just frustrating. I tried both bundle exec and bin/rake and neither chased the issue will try rebuilding to see if that solves the issue

Joel Buzzanco
PLUS
Joel Buzzanco
Courses Plus Student 2,738 Points

Hi, I am having the same issue as Chris Gray,

how do you uninstall rake 11.0 ? is it via command prompt? Then you said to change the rake file version to 0.9.6 . I know this may seem like a dumb question but I guess I don't know how to uninstall it.

nulled
nulled
1,890 Points
treehouse:~/projects/odot (master *) $ gem uninstall rake 11.0

Select gem to uninstall:
 1. rake-10.5.0
 2. rake-10.1.0
 3. rake-11.1.2
 4. All versions
> 3.         
Successfully uninstalled rake-11.1.2