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 34 :foreign_key => :assignee_id,
35 35 :dependent => :destroy
36 36  
  37 + validates :projects_limit,
  38 + :presence => true,
  39 + :numericality => {:greater_than_or_equal_to => 0}
  40 +
  41 +
37 42 before_create :ensure_authentication_token
38 43 alias_attribute :private_token, :authentication_token
39 44 scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) }
... ... @@ -82,5 +87,6 @@ end
82 87 # linkedin :string(255) default(""), not null
83 88 # twitter :string(255) default(""), not null
84 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 18 # There was a problem calling this web hook, let's forget about it.
19 19 end
20 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 +
... ...
db/schema.rb
... ... @@ -13,18 +13,6 @@
13 13  
14 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 16 create_table "issues", :force => true do |t|
29 17 t.string "title"
30 18 t.integer "assignee_id"
... ...
spec/models/user_spec.rb
... ... @@ -65,5 +65,6 @@ end
65 65 # linkedin :string(255) default(""), not null
66 66 # twitter :string(255) default(""), not null
67 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 52 end
53 53 end
54 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 +
... ...