activeadmin-reform 0.2.0 → 0.2.1

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: 3b57cf76087dee6fbc7ec42507e0b62f28205a1a
4
- data.tar.gz: 30b6c7abf2867fa0e0159bdc8c33e71d02e647c4
3
+ metadata.gz: 0a305e245d1e8f6ac3758c1bf7ea2322d7c8a660
4
+ data.tar.gz: e846405d5c62de356d0ba89f229d3c55b62575e4
5
5
  SHA512:
6
- metadata.gz: 0b50e20d28f8a443e83796f0ec92f8586105d1d1faee899a31b2f40976655c4058d197fdecfad25fdd1d63107ef4e61e8464469299d9d569e1e670b921fb37a0
7
- data.tar.gz: f39944434946235702a6d7da515c860051aa5c7a3b4335230e85b9b5dad54b4929c3335febc3c5452c97e681c8c8600bd1b65e79b5efc12543636407426c8820
6
+ metadata.gz: 6562a54f864439d160273ae06d9cf4d5cf57a1afa12cd5156f024df015e99be65143a17c8d2369da642283325115dbb24383f767b65d7bc8ce6e0adba21e60b4
7
+ data.tar.gz: 1a1834ae1d33b0b6568ff450aaec0e97502f28d5bf2d69b27bcc26012a17aa6e65423fbc065c54ec02ce56336e24d81bd3e8c191fb491164588836b8d60ca4cc
@@ -0,0 +1,15 @@
1
+ ### Expected behavior
2
+
3
+ ### Actual behavior
4
+
5
+ ### Steps to reproduce behavior
6
+
7
+ ### Reform version
8
+
9
+ ### ActiveAdmin version
10
+
11
+ ### ActiveAdmin::Reform version
12
+
13
+ ### Environment info
14
+
15
+ ### Screenshots (if relevant)
@@ -0,0 +1,5 @@
1
+ ### What does this PR do?
2
+
3
+ ### If this is related to an existing issue, include a link to it as well.
4
+
5
+ ### Screenshots (if relevant)
@@ -1,3 +1,7 @@
1
+ # 0.2.1
2
+
3
+ * Copy validation errors from ActiveRocord model to Reform, thus in case of such errors they are shown on edit/new pages.
4
+
1
5
  # 0.2.0
2
6
 
3
7
  * Update reform dependency to 2.2.1
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'activeadmin-reform'
7
- spec.version = '0.2.0'
7
+ spec.version = '0.2.1'
8
8
  spec.authors = ['Artyom Bolshakov']
9
9
  spec.email = ['abolshakov@spbtv.com']
10
10
 
@@ -10,6 +10,12 @@ module ActiveAdmin
10
10
 
11
11
  delegate :new_record?, to: :model
12
12
 
13
+ def save_model
14
+ super.tap do
15
+ errors.merge!(model.errors, [])
16
+ end
17
+ end
18
+
13
19
  included do
14
20
  include ::Reform::Form::ModelReflections
15
21
  include ::Reform::Form::ActiveRecord
@@ -11,11 +11,10 @@ module ActiveAdmin
11
11
  module DataAccess
12
12
  extend ActiveSupport::Concern
13
13
 
14
- # @param resource [ActiveRecord::Base]
14
+ # @param _resource [ActiveRecord::Base]
15
15
  # @return [ActiveRecord::Base, Reform::Form]
16
- def apply_decorations(resource)
17
- resource = super(resource)
18
- apply_form(resource)
16
+ def apply_decorations(_resource)
17
+ apply_form(super)
19
18
  end
20
19
 
21
20
  # @param resource [ActiveRecord::Base, Reform::Form]
@@ -23,10 +22,10 @@ module ActiveAdmin
23
22
  # @return [ActiveRecord::Base, Reform::Form]
24
23
  def assign_attributes(resource, attributes)
25
24
  if resource.is_a?(::Reform::Form)
26
- resource.validate(*attributes) unless action_name == 'new'
25
+ resource.validate(*attributes) unless %w(new edit).include?(action_name)
27
26
  resource
28
27
  else
29
- super(resource, attributes)
28
+ super
30
29
  end
31
30
  end
32
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-reform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom Bolshakov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -129,6 +129,8 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
+ - ".github/ISSUE_TEMPLATE.md"
133
+ - ".github/PULL_REQUEST_TEMPLATE.md"
132
134
  - ".gitignore"
133
135
  - ".hound.yml"
134
136
  - ".rspec"