<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Pragmatic Forums | Posts in topic 'Fixtures bypassing ActiveRecord'</title>
    <link>/forums/140/topics/9081.rss</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <item>
      <title>Fixtures bypassing ActiveRecord posted by Danny O Cuiv @ Fri, 27 May 2011 20:57:06 +0000</title>
      <description>&lt;p&gt;I&amp;#8217;m going to bump this one if that&amp;#8217;s OK. (It&amp;#8217;s been almost two weeks and 130 views.)&lt;/p&gt;


	&lt;p&gt;Anyone got any idea what was being referred to here?&lt;/p&gt;


	&lt;p&gt;Thanks,&lt;/p&gt;


	&lt;p&gt;Danny.&lt;/p&gt;</description>
      <pubDate>Fri, 27 May 2011 20:57:06 +0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:140:9081:24879</guid>
      <author>Danny O Cuiv</author>
      <link>https://forums.pragprog.com/forums/140/topics/9081</link>
    </item>
    <item>
      <title>Fixtures bypassing ActiveRecord posted by Danny O Cuiv @ Sun, 15 May 2011 12:24:11 +0000</title>
      <description>&lt;p&gt;Thanks Noel for your answer to my previous question. I&amp;#8217;ve got another. On page 77 of the print edition (or page 83 of the &lt;span class="caps"&gt;PDF&lt;/span&gt;), you say:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;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.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;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 &lt;span class="caps"&gt;API&lt;/span&gt;. create() just calls new() before saving and in the documentation for the &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#method-c-new"&gt;new() method&lt;/a&gt;, it states:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;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.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;This seems to me to be at odds with you wrote above. Can you clarify?&lt;/p&gt;


	&lt;p&gt;Thanks,&lt;/p&gt;


	&lt;p&gt;Danny.&lt;/p&gt;</description>
      <pubDate>Sun, 15 May 2011 12:25:42 +0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:140:9081:24669</guid>
      <author>Danny O Cuiv</author>
      <link>https://forums.pragprog.com/forums/140/topics/9081</link>
    </item>
  </channel>
</rss>
