You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
374 B
16 lines
374 B
class NoUse < ActiveRecord::Base
|
|
# attr_accessible :title, :body
|
|
belongs_to :no_use, :polymorphic => true
|
|
belongs_to :user
|
|
|
|
validates_presence_of :user
|
|
validates_uniqueness_of :user_id, :scope => [:no_use_type, :no_use_id]
|
|
validate :validate_user
|
|
|
|
protected
|
|
|
|
def validate_user
|
|
errors.add :user_id, :invalid unless user.nil? || user.active?
|
|
end
|
|
end
|