diff options
| author | simon <simon@zagal.(none)> | 2009-02-12 00:06:36 +0100 |
|---|---|---|
| committer | hukl <hukl@eight.local> | 2009-02-15 20:22:19 +0100 |
| commit | 0a04dcd23b4e9ef71586e131a646decee2a67061 (patch) | |
| tree | c5d58fcc9770ac05abec73544e30e3ad2a27a7c7 | |
| parent | f10e79a554bd0666de6390c4bc34b52c8ecd936d (diff) | |
* added missing associations
| -rw-r--r-- | app/models/node.rb | 4 | ||||
| -rw-r--r-- | app/models/permission.rb | 1 | ||||
| -rw-r--r-- | app/models/user.rb | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/app/models/node.rb b/app/models/node.rb index 819acac..35904d4 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | class Node < ActiveRecord::Base | 1 | class Node < ActiveRecord::Base |
| 2 | # Mixins and Plugins | ||
| 2 | acts_as_nested_set | 3 | acts_as_nested_set |
| 3 | 4 | ||
| 4 | # Associations | 5 | # Associations |
| 5 | has_many :pages, :order => "revision ASC" | 6 | has_many :pages, :order => "revision ASC" |
| 6 | belongs_to :head, :class_name => "Page", :foreign_key => :head_id | 7 | belongs_to :head, :class_name => "Page", :foreign_key => :head_id |
| 7 | 8 | has_many :permissions | |
| 9 | |||
| 8 | # Callbacks | 10 | # Callbacks |
| 9 | after_create :initialize_empty_page | 11 | after_create :initialize_empty_page |
| 10 | 12 | ||
diff --git a/app/models/permission.rb b/app/models/permission.rb index 1070b7a..3914c9c 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | class Permission < ActiveRecord::Base | 1 | class Permission < ActiveRecord::Base |
| 2 | # Validations | ||
| 2 | validates_presence_of :user_id, :node_id, :granted | 3 | validates_presence_of :user_id, :node_id, :granted |
| 3 | 4 | ||
| 4 | # Associations | 5 | # Associations |
diff --git a/app/models/user.rb b/app/models/user.rb index 3ac0712..2bb4879 100644 --- a/app/models/user.rb +++ b/app/models/user.rb | |||
| @@ -1,9 +1,14 @@ | |||
| 1 | require 'digest/sha1' | 1 | require 'digest/sha1' |
| 2 | 2 | ||
| 3 | class User < ActiveRecord::Base | 3 | class User < ActiveRecord::Base |
| 4 | # Mixins and Plugins | ||
| 4 | include Authentication | 5 | include Authentication |
| 5 | include Authentication::ByPassword | 6 | include Authentication::ByPassword |
| 6 | 7 | ||
| 8 | # Associations | ||
| 9 | has_many :permissions | ||
| 10 | |||
| 11 | # Validations | ||
| 7 | validates_presence_of :login | 12 | validates_presence_of :login |
| 8 | validates_length_of :login, :within => 3..40 | 13 | validates_length_of :login, :within => 3..40 |
| 9 | validates_uniqueness_of :login | 14 | validates_uniqueness_of :login |
