app/models/user.rb in wheels-0.0.48 vs app/models/user.rb in wheels-0.0.49
- old
+ new
@@ -1,22 +1,28 @@
class User < ActiveRecord::Base
- after_create :create_profile
belongs_to :role
has_many :blogs, :dependent => :destroy
has_one :profile, :dependent => :destroy
has_many :galleries, :dependent => :destroy
has_many :access_control_entries, :dependent=>:destroy
+ accepts_nested_attributes_for :profile
+ def initialize(*args)
+ super(*args)
+ build_profile unless profile
+ end
+
def self.nobody
User.new(:role=>Role.nobody)
end
def self.root
User.where(:role_id=>Role.root.id)[0]
end
def create_profile
+
Profile.create(:user=>self) unless self.profile
end
def role?(role)
if role.kind_of?(Role)