edifice 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- @model = record
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
- valid?
27
+ run_callbacks :save do
28
+ valid?
29
+ end
26
30
  end
27
31
 
28
32
  def save!
@@ -1,3 +1,3 @@
1
1
  module Edifice
2
- VERSION = "0.10.1"
2
+ VERSION = "0.10.2"
3
3
  end
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: 53
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 1
10
- version: 0.10.1
9
+ - 2
10
+ version: 0.10.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Coleman