activerecord-be_readonly 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +4 -0
- data/lib/activerecord-be_readonly/model.rb +4 -15
- data/lib/activerecord-be_readonly/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -39,6 +39,10 @@ Or if you are off-rails, but use ActiveRecord, just do this in the model class:
|
|
39
39
|
|
40
40
|
include BeReadonly::Now
|
41
41
|
|
42
|
+
### Contributors
|
43
|
+
|
44
|
+
Thanks to Gabriel Naiman for his patch!
|
45
|
+
|
42
46
|
### License
|
43
47
|
|
44
48
|
Copyright (c) 2012 Gary S. Weaver, released under the [MIT license][lic].
|
@@ -2,13 +2,14 @@ module BeReadonly
|
|
2
2
|
module Model
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
included do
|
6
|
-
end
|
7
|
-
|
8
5
|
module ClassMethods
|
9
6
|
def be_readonly
|
10
7
|
extend BeReadonlyClassMethods # intentionally not in ClassMethods which is automatically extended via ActiveSupport::Concern
|
11
8
|
include BeReadonlyInstanceMethods # intentionally not just InstanceMethods as those would be automatically included via ActiveSupport::Concern
|
9
|
+
|
10
|
+
before_destroy do
|
11
|
+
raise ActiveRecord::ReadOnlyRecord
|
12
|
+
end
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -27,18 +28,6 @@ module BeReadonly
|
|
27
28
|
return true
|
28
29
|
end
|
29
30
|
|
30
|
-
def before_create
|
31
|
-
raise ActiveRecord::ReadOnlyRecord
|
32
|
-
end
|
33
|
-
|
34
|
-
def before_save
|
35
|
-
raise ActiveRecord::ReadOnlyRecord
|
36
|
-
end
|
37
|
-
|
38
|
-
def before_destroy
|
39
|
-
raise ActiveRecord::ReadOnlyRecord
|
40
|
-
end
|
41
|
-
|
42
31
|
def delete
|
43
32
|
raise ActiveRecord::ReadOnlyRecord
|
44
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-be_readonly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|