flash_speaker 0.0.1.4 → 0.0.1.5
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 +4 -4
- data/lib/flash_speaker.rb +8 -4
- 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: 7ecb989be0286c8c7b3a81910a627bdce6454495
|
4
|
+
data.tar.gz: e602b96f7e3916a9607d126952fbbc2ff7a04bcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a674bca8b2ff7cdf0848dbbfa65f7a2b8a58faaf257ed18561503cea6df6904bf118b94976c60ed6dd1cec8719c273a6c596fa06832c56985d5493822b10c9ab
|
7
|
+
data.tar.gz: 5cb8708203ebb083a4a548c5b75ce5c325fd8c83560b1e4f16211c7223767b4783c88c80401cd65c6bff095684ed4adb969e4dcb791ed7abc3ba041c37c58a5d
|
data/lib/flash_speaker.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
module FlashSpeaker
|
2
2
|
def attach_message(success_flag, entity_errors = nil, t_params = {})
|
3
3
|
flash_type = success_flag ? :success : :failed
|
4
|
-
|
4
|
+
if entity_errors.present?
|
5
|
+
full_messages = t_params.delete(:full_messages)
|
6
|
+
flash[:errors] = serialize_errors(entity_errors, full_messages)
|
7
|
+
end
|
5
8
|
flash[flash_type] = message(flash_type, t_params)
|
6
9
|
end
|
7
10
|
|
8
11
|
private
|
9
12
|
|
10
|
-
def serialize_errors(entity_errors)
|
11
|
-
|
13
|
+
def serialize_errors(entity_errors, full_messages = false)
|
14
|
+
return entity_errors unless entity_errors.kind_of? ActiveModel::Errors
|
15
|
+
if full_messages
|
12
16
|
entity_errors.full_messages
|
13
17
|
else
|
14
|
-
entity_errors
|
18
|
+
entity_errors.values.flatten
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_speaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Aberfort
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|