kadmin 0.7.4 → 0.7.5

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: 7772cb1eaba169665d203e20492b7143cca60251
4
- data.tar.gz: d73ac0e923b0358aca98f80244224b89ed8e5195
3
+ metadata.gz: 1c8bc1e06e324a0de09681425f5f96907db191b5
4
+ data.tar.gz: ec72b5e0e54dc188b411fc76fe86f567683e9ee7
5
5
  SHA512:
6
- metadata.gz: 2fece7aa81dfb8896b188ce6ff63d659b729f3f57ff85f633d1c6d1242aa43f364bc3925d93792d6f6f8f700e9fb59c11931523126482811d2a66dbe9896a237
7
- data.tar.gz: 19b15758563a1c5cf3b3b138c19e5c64965acad5324f716d6a7bc5deeac85b77c8c6ef7825aae98dae564644084749abfbee65ccbeb379353b68167a9f681d52
6
+ metadata.gz: 2487fc63349161d22cfd69d841967cee42d562efb950ac577e7cf05374d9c6696a0e22445ae898dc9dc52ff8cf181aa20e5e4ab8ef5559ca42caf305b3be4891
7
+ data.tar.gz: cc9c2c4ccf1be78c2d8699831f01f16e1c0c3f252d9cf4481f9bd128a191749488a138a7a66b4cc508caa813158941ca1b5ccc1f6da32dccc09312daa3fad9b5
@@ -35,6 +35,10 @@ module Kadmin
35
35
  # Also includes ActiveModel::Naming at the same time
36
36
  extend ActiveModel::Translation
37
37
 
38
+ # Provides callback functionality similar to ActiveRecord
39
+ extend ActiveModel::Callbacks
40
+ define_model_callbacks :save
41
+
38
42
  # @return [ActiveModel::Model] underlying model to populate
39
43
  attr_reader :model
40
44
 
@@ -170,13 +174,17 @@ module Kadmin
170
174
 
171
175
  def save
172
176
  saved = false
177
+ # TODO: Check if the top level transaction is necessary here
178
+ # run_callbacks is already a transaction?
173
179
  @model.class.transaction do
174
- saved = @model.save
175
- @associated_forms.values.flatten do |form|
176
- saved &&= form.save
177
- end
180
+ run_callbacks :save do
181
+ saved = @model.save
182
+ @associated_forms.values.flatten do |form|
183
+ saved &&= form.save
184
+ end
178
185
 
179
- raise ActiveRecord::Rollback unless saved
186
+ raise ActiveRecord::Rollback unless saved
187
+ end
180
188
  end
181
189
 
182
190
  return saved
@@ -185,9 +193,11 @@ module Kadmin
185
193
  def save!
186
194
  saved = false
187
195
  @model.class.transaction do
188
- saved = @model.save!
189
- @associated_forms.values.flatten.each do |form|
190
- saved &&= form.save! # no need to raise anything, save! will do so
196
+ run_callbacks :save do
197
+ saved = @model.save!
198
+ @associated_forms.values.flatten.each do |form|
199
+ saved &&= form.save! # no need to raise anything, save! will do so
200
+ end
191
201
  end
192
202
  end
193
203
 
@@ -7,7 +7,7 @@
7
7
  <title>Apps/Services Admin</title>
8
8
  <meta name="description" content="">
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <link rel="apple-touch-icon" href="apple-touch-icon.png">
10
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png">
11
11
  <!-- Place favicon.ico in the root directory -->
12
12
  <%= stylesheet_link_tag "kadmin/application", media: "all" %>
13
13
  <%= yield :stylesheets %>
@@ -1,3 +1,3 @@
1
1
  module Kadmin
2
- VERSION = '0.7.4'.freeze
2
+ VERSION = '0.7.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Pepin-Perreault
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-10-04 00:00:00.000000000 Z
13
+ date: 2018-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
- rubygems_version: 2.6.12
192
+ rubygems_version: 2.5.2
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: Collection of utility, configuration, etc., for admin areas