crud_responder 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crud_responder.rb +10 -2
- data/lib/crud_responder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f881042517fcdee8673fb16561f1984500be25c9
|
4
|
+
data.tar.gz: 39c844168c544604b6890f4709098dea2e6f2e04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4673e1375033c2ec42b9b43b39b72ef89e6968af134fa52b9fecfe7eae1d35146b52f0d2cf2cd0a7f086315decb2029ca95744fa1d5e0b34109337fdf791ce58
|
7
|
+
data.tar.gz: '0248362045a8d7cb1b82845ef758d2f7b41b351e96288559d1bc94b1cc0df5ef2a81f3fa1c427e58790888d133f9fd6b909b0ca92bd336f67211c86b2c282591'
|
data/lib/crud_responder.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|