Commit 212f400d678d75068ae1a5c57110f273464e6ec1

Authored by Valery Sizov
1 parent 8d7aaf0e

fix bug #322

app/models/user.rb
@@ -34,6 +34,11 @@ class User < ActiveRecord::Base @@ -34,6 +34,11 @@ class User < ActiveRecord::Base
34 :foreign_key => :assignee_id, 34 :foreign_key => :assignee_id,
35 :dependent => :destroy 35 :dependent => :destroy
36 36
  37 + validates :projects_limit,
  38 + :presence => true,
  39 + :numericality => {:greater_than_or_equal_to => 0}
  40 +
  41 +
37 before_create :ensure_authentication_token 42 before_create :ensure_authentication_token
38 alias_attribute :private_token, :authentication_token 43 alias_attribute :private_token, :authentication_token
39 scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) } 44 scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) }
@@ -82,5 +87,6 @@ end @@ -82,5 +87,6 @@ end
82 # linkedin :string(255) default(""), not null 87 # linkedin :string(255) default(""), not null
83 # twitter :string(255) default(""), not null 88 # twitter :string(255) default(""), not null
84 # authentication_token :string(255) 89 # authentication_token :string(255)
  90 +# dark_scheme :boolean default(FALSE), not null
85 # 91 #
86 92
app/models/web_hook.rb
@@ -18,3 +18,14 @@ class WebHook < ActiveRecord::Base @@ -18,3 +18,14 @@ class WebHook < ActiveRecord::Base
18 # There was a problem calling this web hook, let's forget about it. 18 # There was a problem calling this web hook, let's forget about it.
19 end 19 end
20 end 20 end
  21 +# == Schema Information
  22 +#
  23 +# Table name: web_hooks
  24 +#
  25 +# id :integer not null, primary key
  26 +# url :string(255)
  27 +# project_id :integer
  28 +# created_at :datetime
  29 +# updated_at :datetime
  30 +#
  31 +
@@ -13,18 +13,6 @@ @@ -13,18 +13,6 @@
13 13
14 ActiveRecord::Schema.define(:version => 20111220190817) do 14 ActiveRecord::Schema.define(:version => 20111220190817) do
15 15
16 - create_table "features", :force => true do |t|  
17 - t.string "name"  
18 - t.string "branch_name"  
19 - t.integer "assignee_id"  
20 - t.integer "author_id"  
21 - t.integer "project_id"  
22 - t.datetime "created_at"  
23 - t.datetime "updated_at"  
24 - t.string "version"  
25 - t.integer "status", :default => 0, :null => false  
26 - end  
27 -  
28 create_table "issues", :force => true do |t| 16 create_table "issues", :force => true do |t|
29 t.string "title" 17 t.string "title"
30 t.integer "assignee_id" 18 t.integer "assignee_id"
spec/models/user_spec.rb
@@ -65,5 +65,6 @@ end @@ -65,5 +65,6 @@ end
65 # linkedin :string(255) default(""), not null 65 # linkedin :string(255) default(""), not null
66 # twitter :string(255) default(""), not null 66 # twitter :string(255) default(""), not null
67 # authentication_token :string(255) 67 # authentication_token :string(255)
  68 +# dark_scheme :boolean default(FALSE), not null
68 # 69 #
69 70
spec/models/web_hook_spec.rb
@@ -52,3 +52,14 @@ describe WebHook do @@ -52,3 +52,14 @@ describe WebHook do
52 end 52 end
53 end 53 end
54 end 54 end
  55 +# == Schema Information
  56 +#
  57 +# Table name: web_hooks
  58 +#
  59 +# id :integer not null, primary key
  60 +# url :string(255)
  61 +# project_id :integer
  62 +# created_at :datetime
  63 +# updated_at :datetime
  64 +#
  65 +