Click here to Skip to main content
15,920,111 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Does anyone remember Micro Men... Pin
glennPattonWork310-Oct-13 5:49
professionalglennPattonWork310-Oct-13 5:49 
GeneralRe: Does anyone remember Micro Men... Pin
OriginalGriff10-Oct-13 5:42
mveOriginalGriff10-Oct-13 5:42 
GeneralRe: Does anyone remember Micro Men... Pin
glennPattonWork310-Oct-13 5:45
professionalglennPattonWork310-Oct-13 5:45 
GeneralRe: Does anyone remember Micro Men... Pin
OriginalGriff10-Oct-13 5:54
mveOriginalGriff10-Oct-13 5:54 
GeneralRe: Does anyone remember Micro Men... Pin
_Maxxx_10-Oct-13 16:11
professional_Maxxx_10-Oct-13 16:11 
GeneralRe: Does anyone remember Micro Men... Pin
Dalek Dave10-Oct-13 11:55
professionalDalek Dave10-Oct-13 11:55 
GeneralRe: Does anyone remember Micro Men... Pin
glennPattonWork310-Oct-13 22:19
professionalglennPattonWork310-Oct-13 22:19 
Generalmethod not found, or, How to Waste Two Hours of Your Life Pin
Marc Clifton10-Oct-13 5:23
mvaMarc Clifton10-Oct-13 5:23 
context: Ruby on Rails

So, here I was ready to write a new feature to verify I can recreate the bug before fixing it, and I started getting these "method not found -- 'activated' in Site" errors, telling me that the method "activated" doesn't exist in the Site model.

1. Yes it does - I added it into the DB a week ago.
2. It's right there in the code for the model.
3. The page runs just fine, why are the feature tests now failing?
4. And why doesn't RoR give me a stack trace, G**d****!

The 3rd item should have given me a big clue. But without the stack trace, I was still really clueless as to where the "activated" method was even being used. So I ended up diving into Rails' ActiveRecord and stepping through the callbacks into the code that it makes when parsing the Ruby code out of the HTML, and sure enough, it's calling:

def display_name
  activated ? name : "#{name} (deactivated)"
end


and sure enough, "activated" doesn't exist, and sure enough, it's not even in the attribute collection for this record.

And then it dawns on me....

...I'm running a feature....

...which means I'm using the test datahase....

...which means I forgot to run 'rake db:test:prepare' to update the test database with my DB change I made last week!

Argh. It's been so long since I've had to fuss with the DB model that I forgot to migrate the changes to the test database as well!

Serious D'Oh! | :doh: and serious Mad | :mad: for a non-stack-traceable, cryptic message that while correct, should be a bit more like "The record does not have this field defined!"

Marc

GeneralRe: method not found, or, How to Waste Two Hours of Your Life Pin
  Forogar  10-Oct-13 6:31
professional  Forogar  10-Oct-13 6:31 
GeneralRe: method not found, or, How to Waste Two Hours of Your Life Pin
Nemanja Trifunovic10-Oct-13 7:01
Nemanja Trifunovic10-Oct-13 7:01 
GeneralRe: method not found, or, How to Waste Two Hours of Your Life Pin
Dan Neely10-Oct-13 7:49
Dan Neely10-Oct-13 7:49 
GeneralRe: method not found, or, How to Waste Two Hours of Your Life Pin
Nemanja Trifunovic10-Oct-13 8:35
Nemanja Trifunovic10-Oct-13 8:35 
GeneralCustomer Service Pin
MehGerbil10-Oct-13 4:53
MehGerbil10-Oct-13 4:53 
GeneralRe: Customer Service Pin
Espen Harlinn10-Oct-13 4:57
professionalEspen Harlinn10-Oct-13 4:57 
GeneralRe: Customer Service Pin
Gregory Gadow10-Oct-13 5:05
Gregory Gadow10-Oct-13 5:05 
GeneralRe: Customer Service Pin
Mark_Wallace10-Oct-13 8:08
Mark_Wallace10-Oct-13 8:08 
GeneralRe: Customer Service Pin
Matt T Heffron10-Oct-13 8:31
professionalMatt T Heffron10-Oct-13 8:31 
GeneralSh*t happens ... Pin
Maximilien10-Oct-13 4:31
Maximilien10-Oct-13 4:31 
GeneralRe: sh*t happens ... Pin
Mike Hankey10-Oct-13 4:49
mveMike Hankey10-Oct-13 4:49 
GeneralRe: sh*t happens ... Pin
Vivi Chellappa10-Oct-13 6:12
professionalVivi Chellappa10-Oct-13 6:12 
GeneralRe: sh*t happens ... Pin
Mike Hankey10-Oct-13 6:26
mveMike Hankey10-Oct-13 6:26 
GeneralRe: sh*t happens ... Pin
S Houghtelin10-Oct-13 6:49
professionalS Houghtelin10-Oct-13 6:49 
GeneralAny Ideas? Pin
Nagy Vilmos10-Oct-13 3:56
professionalNagy Vilmos10-Oct-13 3:56 
GeneralRe: Any Ideas? Pin
Christopher Duncan10-Oct-13 4:03
Christopher Duncan10-Oct-13 4:03 
GeneralRe: Any Ideas? Pin
Nagy Vilmos10-Oct-13 4:09
professionalNagy Vilmos10-Oct-13 4:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.