15 May 2011, 12:25
Generic-user-small

Danny O Cuiv (7 posts)

Thanks Noel for your answer to my previous question. I’ve got another. On page 77 of the print edition (or page 83 of the PDF), you say:

bq. This means you can’t use arbitrary methods of the model as attributes in the fixture the way you can in a create( ) call. Fixture attributes have to be either actual database columns or ActiveRecord associations explicitly defined in the model.

This implies to me that things like virtual attributes are allowed in a call to create, whereas fixtures are restricted to actual database columns (and associations). I was curious and looked this up in the API. create() just calls new() before saving and in the documentation for the new() method, it states:

bq. In both instances, valid attribute keys are determined by the column names of the associated table – hence you can’t have attributes that aren’t part of the table columns.

This seems to me to be at odds with you wrote above. Can you clarify?

Thanks,

Danny.

27 May 2011, 20:57
Generic-user-small

Danny O Cuiv (7 posts)

I’m going to bump this one if that’s OK. (It’s been almost two weeks and 130 views.)

Anyone got any idea what was being referred to here?

Thanks,

Danny.

  You must be logged in to comment