mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Merge pull request #207 from danneu/validate-category-user-id
validate category user_id presence to match DB constraint.
This commit is contained in:
commit
d81cd6eb80
2 changed files with 2 additions and 0 deletions
|
@ -10,6 +10,7 @@ class Category < ActiveRecord::Base
|
|||
has_many :category_featured_users
|
||||
has_many :featured_users, through: :category_featured_users, source: :user
|
||||
|
||||
validates_presence_of :user_id
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name
|
||||
validate :uncategorized_validator
|
||||
|
|
|
@ -4,6 +4,7 @@ require 'spec_helper'
|
|||
|
||||
describe Category do
|
||||
|
||||
it { should validate_presence_of :user_id }
|
||||
it { should validate_presence_of :name }
|
||||
|
||||
it 'validates uniqueness of name' do
|
||||
|
|
Loading…
Reference in a new issue