12 lines
419 B
Ruby
12 lines
419 B
Ruby
class UserExtension < ActiveRecord::Base
|
|
attr_accessible :birthday, :brief_introduction, :fans_num, :finish_project_num, :follow_num, :gender, :good_num, :location, :occupation, :publish_requirement_num, :user_id, :work_experience, :zip_code
|
|
|
|
belongs_to :user
|
|
validate :validate_user
|
|
|
|
def validate_user
|
|
errors.add :user_id, :invalid if user.nil? || !user.active? || User.current != user_id
|
|
end
|
|
|
|
end
|