rails_ops 1.1.28 → 1.1.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47bf9f1036ce2dc4920702cf743def5630af73960f1a750abedc578708454d61
4
- data.tar.gz: d0ddd78f73c479e26f6d601d3dfdbeeefc0f667f0b5d094538f2e1faa210275d
3
+ metadata.gz: f12f6449ae4bdcbe6509a31d3cb0fa3539611a1dea21a94ff2bc21c2764ab609
4
+ data.tar.gz: 0a222457b0adada36f507b56ca3dbca67ddd8f9ca1852fe22cdd0b899d8663f4
5
5
  SHA512:
6
- metadata.gz: 47bd674965ba4ff732f343391b1ad77d11c8ceed69505d519979a2c9a81d45344a9dd21151b1a749ad24fed922c15d3223eee4418317acee947b5cfcb3dbf8cd
7
- data.tar.gz: dea5e80197169cf93b06ea713ca198b97ff711b9171a3869d0da922341d6ebe5286993045009051b03f3eec2e41ed2172bdcc4c9a15943bea93a5bf042fdfbca
6
+ metadata.gz: c5ed687a7bb61559bbac689e6dfa7957d8f0d7a442ac44b5e80de1b318467361949e3fe2490c2daa38e0e75b026d46d57c785bb9e63436d5603c167f916d5973
7
+ data.tar.gz: 8ce961274235ad11ded68887ecae99cd623f100a5f8facf3332f7a21b516555c7b8651a8e75aa30188579dfe9a7f8e384b41a01744feb08099f3eb31b001ebbf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.29 (2022-02-17)
4
+
5
+ * Fix sti type not correct on creating of record
6
+
3
7
  ## 1.1.28 (2022-02-16)
4
8
 
5
9
  * [#22](https://github.com/sitrox/rails_ops/issues/22): Fix error with active_type `>= 2`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.28
1
+ 1.1.29
@@ -134,6 +134,11 @@ class RailsOps::Operation::Model < RailsOps::Operation
134
134
  attributes = attributes.except(*self.class.nested_model_param_keys)
135
135
  end
136
136
 
137
+ # Assign the "type" attribute if we need it
138
+ if _model_class.superclass.finder_needs_type_condition?
139
+ attributes[_model_class.inheritance_column] ||= _model_class.superclass.name
140
+ end
141
+
137
142
  # Do nothing if there are no attributes to assign
138
143
  return if attributes.nil? || attributes.empty?
139
144
 
data/rails_ops.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rails_ops 1.1.28 ruby lib
2
+ # stub: rails_ops 1.1.29 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rails_ops".freeze
6
- s.version = "1.1.28"
6
+ s.version = "1.1.29"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Sitrox".freeze]
11
- s.date = "2022-02-16"
11
+ s.date = "2022-02-17"
12
12
  s.files = [".github/workflows/rubocop.yml".freeze, ".github/workflows/ruby.yml".freeze, ".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, "Appraisals".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "gemfiles/rails_5.1.gemfile".freeze, "gemfiles/rails_5.2.gemfile".freeze, "gemfiles/rails_6.0.gemfile".freeze, "gemfiles/rails_6.1.gemfile".freeze, "gemfiles/rails_7.0.gemfile".freeze, "lib/generators/operation/USAGE".freeze, "lib/generators/operation/operation_generator.rb".freeze, "lib/generators/operation/templates/controller.erb".freeze, "lib/generators/operation/templates/create.erb".freeze, "lib/generators/operation/templates/destroy.erb".freeze, "lib/generators/operation/templates/load.erb".freeze, "lib/generators/operation/templates/update.erb".freeze, "lib/generators/operation/templates/view.erb".freeze, "lib/rails_ops.rb".freeze, "lib/rails_ops/authorization_backend/abstract.rb".freeze, "lib/rails_ops/authorization_backend/can_can_can.rb".freeze, "lib/rails_ops/configuration.rb".freeze, "lib/rails_ops/context.rb".freeze, "lib/rails_ops/controller_mixin.rb".freeze, "lib/rails_ops/exceptions.rb".freeze, "lib/rails_ops/hooked_job.rb".freeze, "lib/rails_ops/hookup.rb".freeze, "lib/rails_ops/hookup/dsl.rb".freeze, "lib/rails_ops/hookup/dsl_validator.rb".freeze, "lib/rails_ops/hookup/hook.rb".freeze, "lib/rails_ops/log_subscriber.rb".freeze, "lib/rails_ops/mixins.rb".freeze, "lib/rails_ops/mixins/authorization.rb".freeze, "lib/rails_ops/mixins/log_settings.rb".freeze, "lib/rails_ops/mixins/model.rb".freeze, "lib/rails_ops/mixins/model/authorization.rb".freeze, "lib/rails_ops/mixins/model/nesting.rb".freeze, "lib/rails_ops/mixins/param_authorization.rb".freeze, "lib/rails_ops/mixins/policies.rb".freeze, "lib/rails_ops/mixins/require_context.rb".freeze, "lib/rails_ops/mixins/routes.rb".freeze, "lib/rails_ops/mixins/schema_validation.rb".freeze, "lib/rails_ops/mixins/sub_ops.rb".freeze, "lib/rails_ops/model_mixins.rb".freeze, "lib/rails_ops/model_mixins/ar_extension.rb".freeze, "lib/rails_ops/model_mixins/parent_op.rb".freeze, "lib/rails_ops/model_mixins/sti_fixes.rb".freeze, "lib/rails_ops/model_mixins/virtual_attributes.rb".freeze, "lib/rails_ops/model_mixins/virtual_attributes/virtual_column_wrapper.rb".freeze, "lib/rails_ops/model_mixins/virtual_has_one.rb".freeze, "lib/rails_ops/model_mixins/virtual_model_name.rb".freeze, "lib/rails_ops/operation.rb".freeze, "lib/rails_ops/operation/model.rb".freeze, "lib/rails_ops/operation/model/create.rb".freeze, "lib/rails_ops/operation/model/destroy.rb".freeze, "lib/rails_ops/operation/model/load.rb".freeze, "lib/rails_ops/operation/model/update.rb".freeze, "lib/rails_ops/profiler.rb".freeze, "lib/rails_ops/profiler/node.rb".freeze, "lib/rails_ops/railtie.rb".freeze, "lib/rails_ops/scoped_env.rb".freeze, "lib/rails_ops/virtual_model.rb".freeze, "rails_ops.gemspec".freeze, "test/db/models.rb".freeze, "test/db/schema.rb".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/assets/config/manifest.js".freeze, "test/dummy/app/assets/images/.keep".freeze, "test/dummy/app/assets/javascripts/application.js".freeze, "test/dummy/app/assets/javascripts/cable.js".freeze, "test/dummy/app/assets/javascripts/channels/.keep".freeze, "test/dummy/app/assets/stylesheets/application.css".freeze, "test/dummy/app/channels/application_cable/channel.rb".freeze, "test/dummy/app/channels/application_cable/connection.rb".freeze, "test/dummy/app/controllers/application_controller.rb".freeze, "test/dummy/app/controllers/concerns/.keep".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/jobs/application_job.rb".freeze, "test/dummy/app/mailers/application_mailer.rb".freeze, "test/dummy/app/models/animal.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/bird.rb".freeze, "test/dummy/app/models/cat.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/dog.rb".freeze, "test/dummy/app/models/flower.rb".freeze, "test/dummy/app/models/group.rb".freeze, "test/dummy/app/models/nightingale.rb".freeze, "test/dummy/app/models/phoenix.rb".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/app/views/layouts/application.html.erb".freeze, "test/dummy/app/views/layouts/mailer.html.erb".freeze, "test/dummy/app/views/layouts/mailer.text.erb".freeze, "test/dummy/bin/bundle".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/bin/update".freeze, "test/dummy/bin/yarn".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/cable.yml".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/development.rb".freeze, "test/dummy/config/environments/production.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/initializers/application_controller_renderer.rb".freeze, "test/dummy/config/initializers/assets.rb".freeze, "test/dummy/config/initializers/backtrace_silencers.rb".freeze, "test/dummy/config/initializers/cookies_serializer.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/mime_types.rb".freeze, "test/dummy/config/initializers/rails_ops.rb".freeze, "test/dummy/config/initializers/wrap_parameters.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/config/secrets.yml".freeze, "test/dummy/config/spring.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/lib/assets/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/package.json".freeze, "test/dummy/public/404.html".freeze, "test/dummy/public/422.html".freeze, "test/dummy/public/500.html".freeze, "test/dummy/public/apple-touch-icon-precomposed.png".freeze, "test/dummy/public/apple-touch-icon.png".freeze, "test/dummy/public/favicon.ico".freeze, "test/dummy/tmp/.keep".freeze, "test/test_helper.rb".freeze, "test/unit/rails_ops/generators/operation_generator_test.rb".freeze, "test/unit/rails_ops/mixins/model/nesting.rb".freeze, "test/unit/rails_ops/mixins/policies_test.rb".freeze, "test/unit/rails_ops/operation/model/create_test.rb".freeze, "test/unit/rails_ops/operation/model/load_test.rb".freeze, "test/unit/rails_ops/operation/model/sti_test.rb".freeze, "test/unit/rails_ops/operation/model/update_test.rb".freeze, "test/unit/rails_ops/operation/model_test.rb".freeze, "test/unit/rails_ops/operation/update_auth_test.rb".freeze, "test/unit/rails_ops/operation/update_lazy_auth_test.rb".freeze, "test/unit/rails_ops/operation_test.rb".freeze]
13
13
  s.rubygems_version = "3.1.2".freeze
14
14
  s.summary = "An operations service layer for rails projects.".freeze
@@ -34,6 +34,30 @@ class RailsOps::Operation::Model::StiTest < ActiveSupport::TestCase
34
34
  end
35
35
  end
36
36
 
37
+ UPDATE_DOG_OP = Class.new(RailsOps::Operation::Model::Update) do
38
+ model Dog do
39
+ attribute :my_virtual_dog_name
40
+ end
41
+ end
42
+
43
+ CREATE_DOG_OP = Class.new(RailsOps::Operation::Model::Create) do
44
+ model Dog do
45
+ attribute :my_virtual_dog_name
46
+ end
47
+ end
48
+
49
+ UPDATE_PHOENIX_OP = Class.new(RailsOps::Operation::Model::Update) do
50
+ model Phoenix do
51
+ attribute :my_virtual_phoenix_name
52
+ end
53
+ end
54
+
55
+ CREATE_PHOENIX_OP = Class.new(RailsOps::Operation::Model::Create) do
56
+ model Phoenix do
57
+ attribute :my_virtual_phoenix_name
58
+ end
59
+ end
60
+
37
61
  def test_load_animal
38
62
  model = LOAD_ANIMAL_OP.new(id: @dog.id).model
39
63
  assert_equal 'Dog', model.type
@@ -67,4 +91,36 @@ class RailsOps::Operation::Model::StiTest < ActiveSupport::TestCase
67
91
  assert model.is_a?(LOAD_PHOENIX_OP.model)
68
92
  assert_nothing_raised { model.my_virtual_phoenix_name = 'Lenny' }
69
93
  end
94
+
95
+ def test_create_dog
96
+ op = CREATE_DOG_OP.new.run!
97
+
98
+ assert_equal 'Dog', op.model.type
99
+ assert op.model.is_a?(CREATE_DOG_OP.model)
100
+ assert_nothing_raised { op.model.my_virtual_dog_name = 'Lenny' }
101
+ end
102
+
103
+ def test_update_dog
104
+ op = UPDATE_DOG_OP.new(id: @dog.id).run!
105
+
106
+ assert_equal 'Dog', op.model.type
107
+ assert op.model.is_a?(UPDATE_DOG_OP.model)
108
+ assert_nothing_raised { op.model.my_virtual_dog_name = 'Lenny' }
109
+ end
110
+
111
+ def test_create_phoenix
112
+ op = CREATE_PHOENIX_OP.new.run!
113
+
114
+ assert_equal 'Phoenix', op.model.type
115
+ assert op.model.is_a?(CREATE_PHOENIX_OP.model)
116
+ assert_nothing_raised { op.model.my_virtual_phoenix_name = 'Lenny' }
117
+ end
118
+
119
+ def test_update_phoenix
120
+ op = UPDATE_PHOENIX_OP.new(id: @phoenix.id).run!
121
+
122
+ assert_equal 'Phoenix', op.model.type
123
+ assert op.model.is_a?(UPDATE_PHOENIX_OP.model)
124
+ assert_nothing_raised { op.model.my_virtual_phoenix_name = 'Lenny' }
125
+ end
70
126
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.28
4
+ version: 1.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-16 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal