crud_responder 0.3.1 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 919d9b77b71cc31835e4c60117530b030d65fc5e
4
- data.tar.gz: 2a9430b2b94a0d5129d0ba052170a1787789b40c
3
+ metadata.gz: f881042517fcdee8673fb16561f1984500be25c9
4
+ data.tar.gz: 39c844168c544604b6890f4709098dea2e6f2e04
5
5
  SHA512:
6
- metadata.gz: fe1ccca3ee2ae9f4a242d615ceadfa6b3baa26b32e74d28018c70f0179739e85c92ce46597598a1dff750612860442f5f5c2427d25b84915d5c32f71823dee63
7
- data.tar.gz: 2171ea017433896489fc11d2a5ae9901ee28fe30810b1d7013e21cbadcf5daaa283c44767caade7b33a00801685ca8f55271b60c0663a60f6da6b9b55773931b
6
+ metadata.gz: 4673e1375033c2ec42b9b43b39b72ef89e6968af134fa52b9fecfe7eae1d35146b52f0d2cf2cd0a7f086315decb2029ca95744fa1d5e0b34109337fdf791ce58
7
+ data.tar.gz: '0248362045a8d7cb1b82845ef758d2f7b41b351e96288559d1bc94b1cc0df5ef2a81f3fa1c427e58790888d133f9fd6b909b0ca92bd336f67211c86b2c282591'
@@ -22,13 +22,13 @@ module CrudResponder
22
22
 
23
23
  def success(options, object, kaller)
24
24
  flash_success(options[:success_message] || DefaultNotification.new(object, kaller).text(true))
25
- redirect_to options[:success_url]
25
+ redirect_to_url_smart(options[:success_url])
26
26
  end
27
27
 
28
28
  def error(options, object, kaller)
29
29
  flash_error(options[:error_message] || DefaultNotification.new(object, kaller).text(false))
30
30
  if options[:error_url]
31
- redirect_to options[:error_url]
31
+ redirect_to_url_smart(options[:error_url])
32
32
  else
33
33
  render options[:error_action]
34
34
  end
@@ -70,4 +70,12 @@ module CrudResponder
70
70
  def truncate_message(msg)
71
71
  truncate(msg.to_s, length: 256, escape: false)
72
72
  end
73
+
74
+ def redirect_to_url_smart(url)
75
+ if url == :back && Rails.version >= '5.1'
76
+ redirect_back(fallback_location: '/')
77
+ else
78
+ redirect_to url
79
+ end
80
+ end
73
81
  end
@@ -1,3 +1,3 @@
1
1
  module CrudResponder
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crud_responder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Antonyan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-02 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler