Permalink
Browse files

Minor: Reordered some of the model stuff.

  • Loading branch information...
1 parent a2a66a1 commit b35509b5cd5b1f0240e09ac015a3a5c9c0dcc003 @jnunemaker jnunemaker committed Nov 18, 2009
Showing with 17 additions and 17 deletions.
  1. +17 −17 test/models.rb
View
@@ -23,6 +23,12 @@ def ==(other)
end
end
+module AccountsExtensions
+ def inactive
+ all(:last_logged_in => nil)
+ end
+end
+
class Post
include MongoMapper::Document
@@ -71,10 +77,18 @@ class Enter < Message; end
class Exit < Message; end
class Chat < Message; end
-module AccountsExtensions
- def inactive
- all(:last_logged_in => nil)
+class Room
+ include MongoMapper::Document
+
+ key :name, String
+ many :messages, :polymorphic => true, :order => 'position' do
+ def older
+ all(:position => {'$gt' => 5})
+ end
end
+ many :latest_messages, :class_name => 'Message', :order => 'position desc', :limit => 2
+
+ many :accounts, :polymorphic => true, :extend => AccountsExtensions
end
class Account
@@ -89,20 +103,6 @@ class Account
class User < Account; end
class Bot < Account; end
-class Room
- include MongoMapper::Document
-
- key :name, String
- many :messages, :polymorphic => true do
- def older
- all(:position => {'$gt' => 5})
- end
- end
- many :latest_messages, :class_name => 'Message', :order => 'position desc', :limit => 2
-
- many :accounts, :polymorphic => true, :extend => AccountsExtensions
-end
-
class Answer
include MongoMapper::Document

0 comments on commit b35509b

Please sign in to comment.