moirai 0.4.1 → 0.4.3
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/CHANGELOG.md +10 -2
- data/lib/moirai/engine.rb +12 -4
- data/lib/moirai/translation_helper.rb +1 -1
- data/lib/moirai/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e417177bded1e57fa207b75a86d1b26c7b0d39aa6800b43a7d8a4c15d2926a86
|
4
|
+
data.tar.gz: 248a19eaa9ab8eb10113be5166ae7f327f6c368cfaedd323c16296d187d2c35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb076f72b6715f531af179c2a76802761a2e656e1cec4e27afe7d8bd6c6bda25835b689941eb450c4a5fa1a3b8aed21f624e7cc416873af6333b284191c4139e
|
7
|
+
data.tar.gz: dc1cf7853270e580be8af708a3c4e21ad43efcc63a3a1301d28268af82d4933c07d10969f464bf049f07af328254b0036e1af6540425d2ea7d67e4f32be60802
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
+
## 0.4.3
|
2
|
+
|
3
|
+
* Do not initialize moirai if we don't have a database connection. ([@coorasse][])
|
4
|
+
|
5
|
+
## 0.4.2
|
6
|
+
|
7
|
+
* Fix bug when the params is defined but is `nil`. ([@coorasse][])
|
8
|
+
|
1
9
|
## 0.4.1
|
2
10
|
|
3
|
-
* Fix bug when the string is not a string, but a boolean
|
11
|
+
* Fix bug when the string is not a string, but a boolean. ([@coorasse][])
|
4
12
|
|
5
13
|
## 0.4.0 - Breaking Changes ⚠️
|
6
14
|
|
@@ -12,7 +20,7 @@ config.moirai.enable_inline_editing = ->(params:) { your_options_here }
|
|
12
20
|
|
13
21
|
move in here the conditions you had previously defined in the helper.
|
14
22
|
|
15
|
-
* Moirai now works also in emails. That's why we have a breaking change.
|
23
|
+
* Moirai now works also in emails. That's why we have a breaking change. ([@coorasse][])
|
16
24
|
|
17
25
|
## 0.3.1
|
18
26
|
|
data/lib/moirai/engine.rb
CHANGED
@@ -10,18 +10,26 @@ module Moirai
|
|
10
10
|
|
11
11
|
config.moirai = ActiveSupport::OrderedOptions.new
|
12
12
|
|
13
|
+
def self.on_sqlite?
|
14
|
+
defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) &&
|
15
|
+
ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::SQLite3Adapter)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.on_postgres?
|
19
|
+
ActiveRecord::Base.connection.table_exists?("moirai_translations")
|
20
|
+
end
|
21
|
+
|
13
22
|
config.after_initialize do
|
14
23
|
I18n.original_backend = I18n.backend
|
15
24
|
table_created =
|
16
25
|
begin
|
17
|
-
|
18
|
-
|
19
|
-
ActiveRecord::Base.connection.table_exists?("moirai_translations")
|
20
|
-
rescue ActiveRecord::NoDatabaseError
|
26
|
+
on_sqlite? || on_postgres?
|
27
|
+
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
|
21
28
|
false
|
22
29
|
end
|
23
30
|
if table_created
|
24
31
|
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Moirai.new, I18n.backend)
|
32
|
+
Rails.logger.info("moirai has been enabled.")
|
25
33
|
else
|
26
34
|
Rails.logger.warn("moirai disabled: tables have not been generated yet.")
|
27
35
|
end
|
@@ -25,7 +25,7 @@ module ActionView::Helpers::TranslationHelper # rubocop:disable Lint/ConstantDef
|
|
25
25
|
alias_method :t, :translate
|
26
26
|
|
27
27
|
def moirai_edit_enabled?
|
28
|
-
Moirai.enable_inline_editing.call(params: defined?(params) ? params : {})
|
28
|
+
Moirai.enable_inline_editing.call(params: defined?(params) ? (params || {}) : {})
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
data/lib/moirai/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moirai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Rodi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-11-
|
13
|
+
date: 2024-11-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|