edifice 0.10.1 → 0.10.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/lib/edifice/form_model.rb +6 -2
- data/lib/edifice/version.rb +1 -1
- metadata +3 -3
data/lib/edifice/form_model.rb
CHANGED
@@ -5,12 +5,14 @@ module Edifice
|
|
5
5
|
include ActiveModel::Validations
|
6
6
|
include ActiveModel::Conversion
|
7
7
|
extend ActiveModel::Naming
|
8
|
+
extend ActiveModel::Callbacks
|
9
|
+
define_model_callbacks :save
|
8
10
|
|
9
11
|
# more or less the same as activerecord's one
|
10
12
|
class RecordInvalid < Exception
|
11
13
|
attr_reader :record
|
12
14
|
def initialize(record)
|
13
|
-
@
|
15
|
+
@record = record
|
14
16
|
errors = @record.errors.full_messages.join(", ")
|
15
17
|
super(errors)
|
16
18
|
end
|
@@ -22,7 +24,9 @@ module Edifice
|
|
22
24
|
|
23
25
|
# default implementation, override as necessary
|
24
26
|
def save
|
25
|
-
|
27
|
+
run_callbacks :save do
|
28
|
+
valid?
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
def save!
|
data/lib/edifice/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edifice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 10
|
9
|
-
-
|
10
|
-
version: 0.10.
|
9
|
+
- 2
|
10
|
+
version: 0.10.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Coleman
|