Sha256: eb545103df1d9d14a32d24689ee21429380374bb783b812149b7fa55fe262b6f

Contents?: true

Size: 621 Bytes

Versions: 61

Compression:

Stored size: 621 Bytes

Contents

class User < ActiveRecord::Base
  before_create :create_profile
  belongs_to :role
  has_many :blogs, :dependent => :destroy
  has_one :profile, :dependent => :destroy
  has_many :galleries, :dependent => :destroy


  def create_profile
    self.profile ||= Profile.create(:user => self)
  end

  def role=(role)
    if role.kind_of? Role
      self.role_id = role.id
    else
      role = role.to_s.camelize
      if role.is_numeric?
        self.role_id= role
      else
        self.role_id= Role.find_by_name(role).id
      end
    end
  end

  def confirm!
    self.confirmed_at = DateTime::now
    save
  end

end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
wheels-0.1.30 lib/wheels/user.rb
wheels-0.1.28 lib/wheels/user.rb
wheels-0.1.27 lib/wheels/user.rb
wheels-0.1.25 lib/wheels/user.rb
wheels-0.1.24 lib/wheels/user.rb
wheels-0.1.23 lib/wheels/user.rb
wheels-0.1.22 lib/wheels/user.rb
wheels-0.1.21 lib/wheels/user.rb
wheels-0.1.20 lib/wheels/user.rb
wheels-0.1.19 lib/wheels/user.rb
wheels-0.1.18 lib/wheels/user.rb
wheels-0.1.17 lib/wheels/user.rb
wheels-0.1.16 lib/wheels/user.rb
wheels-0.1.15 lib/wheels/user.rb
wheels-0.1.14 lib/wheels/user.rb
wheels-0.1.13 lib/wheels/user.rb
wheels-0.1.12 lib/wheels/user.rb
wheels-0.1.11 lib/wheels/user.rb
wheels-0.1.10 lib/wheels/user.rb
wheels-0.1.9 lib/wheels/user.rb