So today I decided (and now I forget exactly why) to try out the relatively new (Rails 2.0 at least) way of doing fixtures in Rails. It comes from a plugin called Rathole (see here) and means that instead of:
we can do:
by allowing the fixtures to automatically generate the id's a source of brittleness (which anyone who has needed to insert a fixture will be familiar with) is removed. Not to mention the fixtures become smaller and more intelligible. There's a bunch of other nice stuff to do with associations. All in all quite a win.
If it worked.
That's the thing, when I change my fixture:
user_id: 1 # user 'matt'
all I get is:
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'user' in 'field list'
which is less than helpful because, of course, there is no
user column that's the whole point. The fixtures should be removing that an inserting an autogenerated
user_id column in it's place.
I have no idea why this isn't working. I'm using Rails 2.0.2 and i've verified that changeset 8036 seems to be there. It's just not working.
Now I have spent some time converting all my fixtures and none of my tests run which is a bit crippling. Well, that is to say they run, but it takes about 10 minutes to finish printing the complete list of identical exceptions and stack traces.
If anyone can help me out here it would be much appreciated.
Update: I dropped John Barnette, the original author of the Rathole plugin, a line and he quickly replied:
Generally when I see the sort of behavior that you're describing it's
because while the fixture has been change to remove the _id prefix, it
hasn't been changed to match the association name instead of the
which was exactly the problem in this case. There were a couple of instances where i'd made that mistake. Fixing that has raised a couple of problems of it's own but they'll be worth solving because the new fixtures are so much more convenient.
I think I called this one back in 2001:
Worst. President. Ever.
History News Network's poll of 109 historians found that 61 percent of them rank Bush as "worst ever"
among U.S. presidents. 96 percent of the respondents place the Bush presidency in the bottom tier of
American presidencies. 98 percent label it a "failure."
This marks a dramatic deterioration for Bush. Previously he wasn't viewed in the most positive terms,
but there was a consensus that he wasn't the "worst of the worst" either. That was in the spring of 2004.
In the meantime, Bush has established himself as the torture president, the basis for his invasion of Iraq
has been exposed as a fraud, the Iraq War itself has gone disastrously, the nation's network of alliances
has faded, and the economy has gone into a tailspin-not to mention the bungled handling of relief for
victims of hurricane Katrina. In 2004, only 12 percent of historians were ready to place Bush dead last.
I wonder how much responsibility those who voted Bush into power not once, but twice, feel? I wonder also at those justices that handed Bush his first victory. How have they benefited?