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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf6996d17ba9835d8a05879a2552a846f7547b0d
4
- data.tar.gz: 371e47d1ae8d981895aeb02db3726b02f1f0c223
3
+ metadata.gz: b3de7ae35808de5d96fa05642edd7736c6c35e09
4
+ data.tar.gz: c102966b921057816ee951f7d78198ce07da88e7
5
5
  SHA512:
6
- metadata.gz: 8ffccced44051c01560f2fd21668634c10f01bfd82128c8b7c3e525015d7ec07afecf0186a0555a18b4496d80c4962b38ad26c43d63bb8e392330773b4df0946
7
- data.tar.gz: 1134a9f9f6a677aa17fb84e2c83c6e1c459dfb3166d8ccc6198b8e59cb828c0ad498f16842ad2791a8e4b89dcefc751650d12f651bac72c7537b502c1b750e47
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; send(self.class.code_column); end
19
- def to_s; name.to_s; end
20
- def to_i; send(self.class.primary_key); end
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?; false; end
25
- def valid?; true; end
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
@@ -1,3 +1,3 @@
1
1
  module StaticModels
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
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.2
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-02 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport