Permalink
Browse files

Projects now validate uniqueness of their name, which makes Timesheet…

…s form a bit more usable
  • Loading branch information...
1 parent 1d2f817 commit adf280094e563f1e78a3cee127649c4d56cf5303 @enricob committed Apr 13, 2009
Showing with 2 additions and 0 deletions.
  1. +1 −0 app/models/project.rb
  2. +1 −0 spec/models/project_spec.rb
@@ -1,5 +1,6 @@
class Project < ActiveRecord::Base
has_many :activity_types, :dependent => :destroy
validates_presence_of :name
+ validates_uniqueness_of :name
accepts_nested_attributes_for :activity_types, :allow_destroy => true
end
@@ -15,6 +15,7 @@
end
it { should validate_presence_of(:name) }
+ it { should validate_uniqueness_of(:name) }
it { should have_many(:activity_types) }
it "should accept nested attributes values for activity types" do

0 comments on commit adf2800

Please sign in to comment.