inertia_rails 1.8.0 → 1.9.0

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
  SHA256:
3
- metadata.gz: 0c9c8c3b0d07a467179b741d6ce1f9d79d6190f0c71ecbe3e960536929055caf
4
- data.tar.gz: 2f0f3a5ac49480f5fae1b28c771fe7bc3ea6de2953c734e0015b617fcc70a8bc
3
+ metadata.gz: 4a3b7e29654788cf3c7ac7307d83fd258d47c7ee5daa36745998c944ae31b472
4
+ data.tar.gz: 4070f2fb9ae9d253a94c98d7f8705f713248788b63611bfa30f36edaaa15a73e
5
5
  SHA512:
6
- metadata.gz: d696ea9c18535afb527dfead16bd271613d2bb561936ffd470e85caf78e20138109c6247d2e21724751a94acafc5548849533e50da3774d510528ed6f1221bc4
7
- data.tar.gz: 6aa06ca052045c5f27c8f1a801889cf26ed77bb5e660875e6fe74cd3c7a30eab7c306385b9707842c8a52a8131c797405741a5f34e5397a64b58da2e98c5ae62
6
+ metadata.gz: 2aa986d0e69a1db45d94ca921771e7ff82ec61c53008dbf756b9eed3728837d314ee773e12acd27a98fcb1372d67f44653fa749ef24b2959759849b2be925ae9
7
+ data.tar.gz: ab880524135f77d437aeb4c8dfa1e3e23ddc69db5d99a5adea6139d17331db7981f691921ae10b84d41122d06fc1a01a456af902ed3fcde704fb9d4bf1b9f08a
@@ -8,7 +8,7 @@ jobs:
8
8
  fail-fast: false
9
9
  matrix:
10
10
  ruby: [2.6, 2.7]
11
- rails: ['5.0', '5.1', '5.2', '6.0']
11
+ rails: ['5.0', '5.1', '5.2', '6.0', '6.1']
12
12
 
13
13
  runs-on: ubuntu-latest
14
14
  name: Test against Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
data/Appraisals CHANGED
@@ -1,3 +1,7 @@
1
+ appraise "rails-6.1" do
2
+ gem "rails", "~> 6.1.0"
3
+ end
4
+
1
5
  appraise "rails-6.0" do
2
6
  gem "rails", "~> 6.0.3", '>= 6.0.3.2'
3
7
  end
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.9.0] - 2021-01-17
8
+
9
+ * Added the same inertia awareness that redirect_to has to redirect_back
10
+
7
11
  ## [1.8.0] - 2020-12-08
8
12
 
9
13
  * Add `inertia` route helper feature
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 6.1.0"
6
+
7
+ gemspec path: "../"
@@ -20,17 +20,31 @@ module InertiaRails
20
20
  end
21
21
  end
22
22
 
23
+ private
24
+
23
25
  def inertia_location(url)
24
26
  headers['X-Inertia-Location'] = url
25
27
  head :conflict
26
28
  end
27
29
 
28
30
  def redirect_to(options = {}, response_options = {})
29
- if (inertia_errors = response_options.fetch(:inertia, {}).fetch(:errors, nil))
31
+ capture_inertia_errors(response_options)
32
+ super(options, response_options)
33
+ end
34
+
35
+ def redirect_back(fallback_location:, allow_other_host: true, **options)
36
+ capture_inertia_errors(options)
37
+ super(
38
+ fallback_location: fallback_location,
39
+ allow_other_host: allow_other_host,
40
+ **options,
41
+ )
42
+ end
43
+
44
+ def capture_inertia_errors(options)
45
+ if (inertia_errors = options.dig(:inertia, :errors))
30
46
  session[:inertia_errors] = inertia_errors
31
47
  end
32
-
33
- super(options, response_options)
34
48
  end
35
49
  end
36
50
  end
@@ -1,3 +1,3 @@
1
1
  module InertiaRails
2
- VERSION = "1.8.0"
2
+ VERSION = "1.9.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inertia_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Knoles
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-12-08 00:00:00.000000000 Z
13
+ date: 2021-01-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -137,6 +137,7 @@ files:
137
137
  - gemfiles/rails_5.1.gemfile
138
138
  - gemfiles/rails_5.2.gemfile
139
139
  - gemfiles/rails_6.0.gemfile
140
+ - gemfiles/rails_6.1.gemfile
140
141
  - inertia_rails.gemspec
141
142
  - lib/inertia_rails.rb
142
143
  - lib/inertia_rails/controller.rb