tsukasaoishi-miyazakiresistance 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/miyazaki_resistance/base.rb +8 -2
- data/lib/miyazakiresistance.rb +1 -1
- metadata +1 -1
@@ -100,7 +100,13 @@ module MiyazakiResistance
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def find_by_id(target)
|
103
|
-
find_by_ids([target])
|
103
|
+
find_by_ids([target]).first
|
104
|
+
end
|
105
|
+
|
106
|
+
def find_and_update(first, args={})
|
107
|
+
list = self.find(first, args)
|
108
|
+
list = [list] unless list.is_a?(Array)
|
109
|
+
list.each {|inst| yield(inst) and inst.save}
|
104
110
|
end
|
105
111
|
|
106
112
|
def count(args = {})
|
@@ -110,7 +116,7 @@ module MiyazakiResistance
|
|
110
116
|
else
|
111
117
|
query = TokyoTyrant::RDBQRY.new(con)
|
112
118
|
query = make_conditions(query, args[:conditions])
|
113
|
-
kaeru_timeout{query.search}
|
119
|
+
kaeru_timeout{query.search.count}
|
114
120
|
end
|
115
121
|
rescue TimeoutError
|
116
122
|
remove_pool(con)
|
data/lib/miyazakiresistance.rb
CHANGED