rocking_chair 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rocking_chair/view.rb +1 -1
- data/test/simply_stored_test.rb +16 -5
- metadata +3 -3
data/lib/rocking_chair/view.rb
CHANGED
@@ -118,7 +118,7 @@ module RockingChair
|
|
118
118
|
filter_items_by_key([foreign_key_id(belongs_to)])
|
119
119
|
filter_items_without_correct_ruby_class
|
120
120
|
filter_deleted_items if options['without_deleted'].to_s == 'true'
|
121
|
-
sort_by_attribute('
|
121
|
+
sort_by_attribute('created_at')
|
122
122
|
end
|
123
123
|
|
124
124
|
def find_by_attribute(attribute_string)
|
data/test/simply_stored_test.rb
CHANGED
@@ -118,11 +118,22 @@ class SimplyStoredTest < Test::Unit::TestCase
|
|
118
118
|
assert_equal 3, @project.users.size
|
119
119
|
assert_equal 2, @project.users(:limit => 2).size
|
120
120
|
end
|
121
|
-
|
122
|
-
should "support order" do
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
|
122
|
+
should "support mixing order and limit" do
|
123
|
+
michael = User.find(User.create!(:firstname => "michael", :project => @project).id)
|
124
|
+
michael.created_at = Time.local(2001)
|
125
|
+
michael.save!
|
126
|
+
|
127
|
+
mickey = User.find(User.create!(:firstname => "mickey", :project => @project).id)
|
128
|
+
mickey.created_at = Time.local(2002)
|
129
|
+
mickey.save!
|
130
|
+
|
131
|
+
mike = User.find(User.create!(:firstname => "mike", :project => @project).id)
|
132
|
+
mike.created_at = Time.local(2003)
|
133
|
+
mike.save!
|
134
|
+
|
135
|
+
assert_equal ["michael", "mickey", "mike"], @project.users(:order => :asc).map(&:firstname)
|
136
|
+
assert_equal ["michael", "mickey", "mike"].reverse, @project.users(:order => :desc).map(&:firstname)
|
126
137
|
end
|
127
138
|
end
|
128
139
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jonathan Weiss
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-10 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|