Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…s form a bit more usable
  • Loading branch information...
commit adf280094e563f1e78a3cee127649c4d56cf5303 1 parent 1d2f817
@enricob authored
Showing with 2 additions and 0 deletions.
  1. +1 −0  app/models/project.rb
  2. +1 −0  spec/models/project_spec.rb
View
1  app/models/project.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
View
1  spec/models/project_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.