Permalink
Browse files

Merge pull request #121 from winfield/hotfix/fix_nilClass_in_cpanel_n…

…odes_index

fix for nil:NilClass in cpanel nodes index view
  • Loading branch information...
2 parents 12290f5 + 67c72ac commit 26cdd8b2706eb4f0bad472f7f8c34d14147c04ed @huacnlee huacnlee committed Dec 2, 2011
Showing with 15 additions and 1 deletion.
  1. +1 −1 app/models/node.rb
  2. +14 −0 spec/models/cpanel/node_spec.rb
View
@@ -14,7 +14,7 @@ class Node
index :section_id
- validates_presence_of :name, :summary
+ validates_presence_of :name, :summary, :section
validates_uniqueness_of :name
has_and_belongs_to_many :followers, :class_name => 'User', :inverse_of => :following_nodes
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe Node do
+
+ describe 'Validates' do
+ it 'should fail saving without specifing a section' do
+ node = Node.new
+ node.name = "Cersei"
+ node.summary = "the Queue"
+ node.save == false
+ end
+ end
+
+end

0 comments on commit 26cdd8b

Please sign in to comment.