tramway-core 3.0 → 3.0.1.1
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/app/decorators/tramway/core/application_decorator.rb +1 -1
- data/app/forms/tramway/core/application_forms/submit_helper.rb +1 -1
- data/app/helpers/tramway/core/inputs_helper.rb +7 -0
- data/app/models/tramway/core/application_record.rb +12 -6
- data/lib/tramway/core/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: 2b99587fbe190053316f4d481dc7746599a74a11875ead37b4e3ac3836d6fd56
|
4
|
+
data.tar.gz: 4d41fa71e1107c838188fae3a2e7910fee5faf7015e24d716305181ee19bb6eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a251c2005d7b60b6b9e9bf4e14fea41d9a161975ba29be43d1749ccefcc0e992069ccaab52608209ba4d7f325e2e3144fcd0c912bb61031a29da2ce742cffdf4
|
7
|
+
data.tar.gz: 6ced496aa25871420199747b46d30c9c1289813b08d76aec995da10eace435adc1fe344491f4563dde407d35b9a2f739c10369b9406738fefd6233edccc37c0a
|
@@ -62,7 +62,7 @@ class Tramway::Core::ApplicationDecorator
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def decorate(object_or_array)
|
65
|
-
if object_or_array.class.superclass == ActiveRecord::Relation
|
65
|
+
if object_or_array.class.superclass == ActiveRecord::Relation || object_or_array.class.to_s.include?('ActiveRecord_AssociationRelation')
|
66
66
|
decorated_array = object_or_array.map do |obj|
|
67
67
|
new obj
|
68
68
|
end
|
@@ -20,7 +20,7 @@ module Tramway::Core::ApplicationForms::SubmitHelper
|
|
20
20
|
rescue StandardError => e
|
21
21
|
if e.try :name
|
22
22
|
Tramway::Error.raise_error :tramway, :core, :application_form, :save, :looks_like_you_have_method,
|
23
|
-
method_name: e.name.to_s.gsub('=', ''), model_class:
|
23
|
+
method_name: e.name.to_s.gsub('=', ''), model_class: model.class, class_name: self.class
|
24
24
|
else
|
25
25
|
raise e
|
26
26
|
end
|
@@ -5,6 +5,13 @@ module Tramway::Core::InputsHelper
|
|
5
5
|
include Tramway::Core::Inputs::PolymorphicAssociationsHelper
|
6
6
|
|
7
7
|
def association_params(form_object:, property:, value:, object:, options: {})
|
8
|
+
full_class_name_association = form_object.class.full_class_name_association(property)
|
9
|
+
|
10
|
+
if full_class_name_association.to_s == 'Tramway::User::User'
|
11
|
+
user = defined?(current_user) ? current_user : current_admin
|
12
|
+
value = user.id
|
13
|
+
end
|
14
|
+
|
8
15
|
build_input_attributes(object: object, property: property, options: options,
|
9
16
|
value: build_value_for_association(form_object, property, value),
|
10
17
|
collection: build_collection_for_association(form_object, property),
|
@@ -13,6 +13,17 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
13
13
|
}
|
14
14
|
scope :admin_scope, -> (_arg) { all }
|
15
15
|
|
16
|
+
# FIXME remove this after testing soft-deletion
|
17
|
+
aasm column: :state do
|
18
|
+
state :active, initial: true
|
19
|
+
state :removed
|
20
|
+
|
21
|
+
event :remove do
|
22
|
+
transitions from: :active, to: :removed
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
16
27
|
include ::PgSearch::Model
|
17
28
|
|
18
29
|
def creator
|
@@ -23,7 +34,7 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
23
34
|
# FIXME: detect inhertited locales
|
24
35
|
class << self
|
25
36
|
def human_attribute_name(attribute_name, *_args)
|
26
|
-
excepted_attributes = %w[created_at updated_at
|
37
|
+
excepted_attributes = %w[created_at updated_at]
|
27
38
|
if attribute_name.to_s.in? excepted_attributes
|
28
39
|
I18n.t "activerecord.attributes.tramway/core/application_record.#{attribute_name}"
|
29
40
|
else
|
@@ -53,9 +64,4 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
53
64
|
AASM::StateMachineStore.fetch(self).machine_names
|
54
65
|
end
|
55
66
|
end
|
56
|
-
|
57
|
-
# FIXME: detect inhertited locales
|
58
|
-
def human_state_name
|
59
|
-
I18n.t "activerecord.state_machines.tramway/core/application_record.state.states.#{state}"
|
60
|
-
end
|
61
67
|
end
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|