static_models 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/static_models.rb +24 -5
- data/lib/static_models/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3de7ae35808de5d96fa05642edd7736c6c35e09
|
4
|
+
data.tar.gz: c102966b921057816ee951f7d78198ce07da88e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85dd4243824b2538696845f2f3fa90b6ee3fe5d3d46a74bf6131451a13ddb1ac23e965fdc6e848590d05993643b3f4e95135b1cfc6388be8705170920e67c362
|
7
|
+
data.tar.gz: 6be976c6129d57cd3bcfcf6ed0c06fdf3f9fc5282635ceebaf7ce4fae87bf08fc0d69c135cce3c657d73be73198c32170d29f29ca4525969d97b4beb80261186
|
data/lib/static_models.rb
CHANGED
@@ -15,14 +15,33 @@ module StaticModels
|
|
15
15
|
attributes.each{|name,value| send("#{name}=", value) }
|
16
16
|
end
|
17
17
|
|
18
|
-
def name
|
19
|
-
|
20
|
-
|
18
|
+
def name
|
19
|
+
send(self.class.code_column)
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
name.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_i
|
27
|
+
send(self.class.primary_key)
|
28
|
+
end
|
21
29
|
|
22
30
|
# Ugly hack to make this compatible with AR validatinos.
|
23
31
|
# It's safe to assume a StaticModel is always valid and never destroyed.
|
24
|
-
def marked_for_destruction
|
25
|
-
|
32
|
+
def marked_for_destruction?
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
def valid?
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
# For compatibility with AR relations in ActiveAdmin and others.
|
41
|
+
# Feel free to override this.
|
42
|
+
def self.where(*args)
|
43
|
+
all
|
44
|
+
end
|
26
45
|
end
|
27
46
|
|
28
47
|
class_methods do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: static_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nubis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|