edifice 0.10.0 → 0.10.1

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.
@@ -6,6 +6,16 @@ module Edifice
6
6
  include ActiveModel::Conversion
7
7
  extend ActiveModel::Naming
8
8
 
9
+ # more or less the same as activerecord's one
10
+ class RecordInvalid < Exception
11
+ attr_reader :record
12
+ def initialize(record)
13
+ @model = record
14
+ errors = @record.errors.full_messages.join(", ")
15
+ super(errors)
16
+ end
17
+ end
18
+
9
19
  def initialize(attributes = {})
10
20
  attributes.each { |n, v| send("#{n}=", v) if respond_to?("#{n}=") }
11
21
  end
@@ -15,6 +25,10 @@ module Edifice
15
25
  valid?
16
26
  end
17
27
 
28
+ def save!
29
+ save || raise(RecordInvalid.new(self))
30
+ end
31
+
18
32
  def self.create(attributes = {})
19
33
  form = new(attributes)
20
34
  form.save
@@ -1,3 +1,3 @@
1
1
  module Edifice
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
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: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 0
10
- version: 0.10.0
9
+ - 1
10
+ version: 0.10.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Coleman
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-11-08 00:00:00 Z
20
+ date: 2011-11-18 00:00:00 Z
21
21
  dependencies: []
22
22
 
23
23
  description: The idea here is to communicate which view is rendering to the javascript so that we can call the correct javascript files in an automagical way.