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:
companies.yml
reeplay:
id: 1
name: reeplay
employees.yml
matt:
id: 1
name: Matt
company_id: 1
we can do:
companies.yml
reeplay:
name: $LABEL
employees.yml
matt:
name: Matt
company: reeplay
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:
playlist_x:
user_id: 1 # user 'matt'
to:
playlist_x:
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.
Recent comments
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago
1 year 31 weeks ago