cowtech-rails 1.6.0.0 → 1.6.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,10 @@ module Cowtech
|
|
20
20
|
0
|
21
21
|
end
|
22
22
|
|
23
|
+
def self.[](what, only_id = false)
|
24
|
+
self.__finalize_record(self.__index_find(what), only_id)
|
25
|
+
end
|
26
|
+
|
23
27
|
def safe_id
|
24
28
|
if self.id then self.id else 0 end
|
25
29
|
end
|
@@ -51,6 +55,27 @@ module Cowtech
|
|
51
55
|
super()
|
52
56
|
end
|
53
57
|
end
|
58
|
+
|
59
|
+
def ==(other)
|
60
|
+
if other.class.to_s != self.class.to_s then
|
61
|
+
self.id == self.class.__index_find(other).id
|
62
|
+
else
|
63
|
+
super
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def !=(other)
|
68
|
+
! (self == other)
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
def self.__index_find(what)
|
73
|
+
self.find(what)
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.__finalize(record, only_id = false)
|
77
|
+
only_id ? record.id : record
|
78
|
+
end
|
54
79
|
end
|
55
80
|
end
|
56
81
|
end
|
data/lib/cowtech/version.rb
CHANGED