<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - Model Relationships]]></title>
		<link>http://railsforum.com/viewtopic.php?id=52460</link>
		<description><![CDATA[The most recent posts in Model Relationships.]]></description>
		<lastBuildDate>Thu, 07 Feb 2013 08:21:13 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Model Relationships]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=159020#p159020</link>
			<description><![CDATA[<p>Just before saving a user, assign it a corresponding profile:<br /></p><div class="codebox"><pre><code>class User &lt; ActiveRecord::Base
  before_save :assign_profile

  private
    def assign_profile
      self.profile = whatever_you want from your Profile model
   end
end</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (Javix)]]></author>
			<pubDate>Thu, 07 Feb 2013 08:21:13 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=159020#p159020</guid>
		</item>
		<item>
			<title><![CDATA[Model Relationships]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=159010#p159010</link>
			<description><![CDATA[<p>Hi, i have two models; user and profile each of which have correct correct relations set.</p><p>I am using an auth gem (devise) however I a record for profile must be inserted for each user, is this a quick fix? should this be done?</p><p>My user model looks like this, </p><p>class User &lt; ActiveRecord::Base<br />&nbsp; devise :database_authenticatable, :registerable,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:recoverable, :rememberable, :trackable, :validatable,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:token_authenticatable, :confirmable, :lockable, :timeoutable<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; attr_accessible :email, :password, :password_confirmation, :remember_me&nbsp; <br />&nbsp; has_one :profile, :dependent =&gt; :destroy<br />end</p>]]></description>
			<author><![CDATA[dummy@example.com (50)]]></author>
			<pubDate>Wed, 06 Feb 2013 15:29:45 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=159010#p159010</guid>
		</item>
	</channel>
</rss>
