-
Also allow single path segments as symbols instead of array for
authorize_param
'spath
argument. Before, paths that were not arrays would lead to the param authorization being ignored silently.Internal reference:
#128987
.
- Fix compatibility issue with older versions of Rails introduced in version 1.5.6
-
#42 Bump nokogiri from 1.16.2 to 1.16.5 to mitigate CVE
-
Lock the version of
sqlite3
to<2.0.0
in order to mitigate sqlite3 errors in CI.Internal reference:
#127570
. -
Modernize deprecation handling to fix the issue where deprecation warnings would lead to deprecation warnings themselves.
Internal reference:
#128487
. -
Freeze default empty array in
RailsOps::Context#op_chain
.
- Add instance method
lock_model_at_build?
toRailsOps::Operation::Model::Load
in order to allow dynamic decision whether locking should occur.
-
Update documentation
-
Add ruby 3.3.0 to CI
- Tag with no changes
- Tag with no changes
- Update documentation
-
Fix deprecation warnings for rails
>= 7.1
-
Add Rails
7.1
to CI -
Remove Ruby
2.6.2
from CI -
Update
schemacop
dependency to>= 3.0.0
Schemacop 3.0
still features
the same functionality as version 2 for backwards-compatibility, and as
such you can keep your schemacop 2 schemas as they are.
- Keep original validation error message when
rescue_validation_error_in_controller
is enabled
- Add parameter
override
to staticmodel
method in model operations
-
Make sure that
RailsOps::Exceptions::SubOpValidationFailed
always results in an Error 500 when handled by a Rails controller.Internal reference:
#114719
.
-
Fix bug introduced in previous release 1.4.4.
Internal reference:
#114719
.
-
Adapt method
sub_op
to catch<op-class>.validation_errors
and re-throw them asRailsOps::Exceptions::SubOpValidationFailed
.Internal reference:
#114719
.
-
Extend the
operation
generator to accept additional flags to skip the generation of certain actions. In particular, the--skip-index
,--skip-show
,--skip-create
,--skip-update
and--skip-destroy
flags were added.Internal reference:
#111041
.
-
Update the
operation
generator such that it complies with the naming conventions laid out in Placing and naming operations. The path were the operations reside and the validation schema key are now generated in singular.Internal reference:
#111055
.
- Fix specifying custom param_key when nesting model operations
- #33: Improve resolving
param_key
in nested model operations.
Please see #33 for more information
on this change. If all of your operations
follow the standard naming conventions (e.g. Operations::User::Update
for
updating a model named User
), no changes will be necessary. If you don't, you
may need to manually specify a param_key
when using nested model operations
(see Model nesting for more information).
- Add
lock_mode
DSL method - Set
Load
operations to use shared locking, andUpdate
andDestroy
operations to use exclusive locking. Please make sure your operations inherit from the correct parent operation, and change the locking mode if it is not the correct one for your operation. More info can be found in the section "Locking" in the Readme
-
Fix marshalling of operation models. This is especially useful for use in conjunction with minitest >= 5.16.0, where exceptions must be marshallable and, as
ActiveRecord::RecordInvalid
exceptions include therecord
which in turn points to a operation model, the record must be marshallable.Internal reference:
#108386
.
-
Adapt param authorization to work in policy chain
on_init
. This has the effect that param authorization runs even when the operation is not performed, e.g. inModel::Load
operations.Internal reference:
#105855
.
-
Also raise
Schemacop::Exceptions::ValidationError
in development mode when the schema validation fails. -
Raise
Schemacop::Exceptions::ValidationError
in XHR requests when schema validation fails instead of responding directly with a400
status code.
-
Rescue
Schemacop::Exceptions::ValidationError
in controller mixin and respond with response code400
. Please see the section Schema best practices in the readme for more information. -
Add config setting
rescue_validation_error_in_controller
to enable/disable the newly added behaviour -
Update Readme with section about best practices
-
Remove Rails
5.1
and5.2
from the CI, as well as Ruby2.5.1
as they were EOL for quite a while now.
- Deprecate undocumented
virtual_has_one
feature
- PR#27: Update id schemata in templates
- Fix sti type not correct on creating of record
- #22: Fix error with active_type
>= 2
- Add
module
option tooperation
generator
-
#25: Add test matrix for unit tests
-
Add compatibility for Rails 7 and Ruby 3.1.0
- #24: Add generator
operation
that generates a controller, operations and empty view files
- Add support for STI in model operations
- No changes to previous release
- Add support for lazy model authorization
- Fix using model operations in conjunction with Single Table Inheritance (STI)
- Fix warnings with Ruby 2.7
- Fix warnings with Ruby 2.7
- Adapt signature of
schema3
method to support other types than hashes
-
Add operation class method
skip_schema_validation
-
Add operation instance method
validate_op_schema!
- Update dependency to support
schemacop
version 3
- Allow
active_type >= 1.3.0
- Fix validation of unchanged nested models.
- Update support for upcoming Schemacop 3
-
Add support for upcoming Schemacop 3. It is still backwards compatible and the schemacop schema version still defaults to 2.
Note that support for the new Schemacop 3 features is not yet documented.
- Add method
lazy_model
toRailsOps::Operation::Model
- Fix parameter inspection bug introduced in 1.1.9.
-
Gracefully filter params when inspecting an operation. If the params included numeric keys in
rails < 6
, this lead to an error. This error is now handeled gracefully and params are not inspected. -
Do not call
inspect
every time an op is run
- Fix bug where only the first hooked operation was called
- Add controller / helper method
model?
- Fix suppressed validation errors by operations called via hookup. Now the exception {RailsOps::Exceptions::HookupOpValidationFailed} is thrown if a hook target operation throws a validation error throws a validation error
- Upgrade
active_type
to~> 1.3.0
for Rails 6 compatibility
- Remove debug output.
- Fix bug introduced in
1.1.0
where params of operations with a schemacop schema were not using "indifferent access" anymore.
- Include the ControllerMixin after
ActionController::Base
has been loaded, as directly callingActionController::Base.send :include, RailsOps::ControllerMixin
in the railtie causes theActionController::Base
to be loaded during Initialization, which is undesirable and will be an error in future Rails versions.
-
Do not require default (CanCanCan) authorization backend anymore so that the Gem
cancancan
is not required by default anymore. If you are using the default authentication backend, add the following line to the top of yourconfig/initializers/rails_ops.rb
file:require 'rails_ops/authorization_backend/can_can_can.rb' ``
-
Breaking changes:
-
Schema validations defined with
schema
are now always run on operation instantiation and not, as before, at time ofbefore_perform
. -
The argument
policy_chain
for the static operation methodschema
is now removed. -
Schema validation now overrides the
params
hash with the return value from Schemacop. This means that Schemacop defaults and casts now can be used for operation params (with bothparams
andosparams
methods). -
RailsOps now requires
schemacop ~> 2.4.2
.
-
- Exclude param named
format
fromop_params
.
- Add param authorization functionality using
authorize_param
- Fix examples in readme
- Pass option
required
to the underlyingbelongs_to
invirtual_has_one
. This fixes an issue where, in Rails > 5, all associations created withvirtual_has_one
were considered required.
- Add global option
config.ensure_authorize_called
(defaults totrue
to be compatible with previous versions)
- Add option
allow_id
tonest_model_op
in order to allow passing IDs to sub-operations. Set tofalse
by default to mimic current behavior.
- Fix bug introduced in 1.0.14 where the controller mixin failed with an exception
- Ensure compatibility with Rails 3.2.
- Set the name of nested params to the modelname, not to the fieldname. This is a follow up from 1.0.11.
- {RailsOps::Context#spawn} now dynamically inferrs current class name in order to spawn a new context. This allows you to subclass the context class and have it spawned with the correct class.
- It is now possible to have nested model ops on belongs_to relations with explicit class_name.
- Fix
defined?
calls in controller mixin so that the mixin can be used without definingcurrent_user
orcurrent_ability
.
- Changes to development setup
- Fix #14 Policy chain
after_perform
is never called.
-
It is now possible to add a policy in front of the policy chain instead of the end. It is however not guaranteed to be the first policy to be run since multiple policies can be prepended to the chain. A prepended policy can't access the operation model, since it is not set yet.
See PR#12.
- Fix automatic controller mixin introduced in 1.0.4. Including the mixin into
ApplicationController
lead to random user-defined helpers not being loaded anymore. The mixin is now included intoActionController::Base
instead.
- Add missing controller mixin automatically so that no (undocumented) manual include is necessary.
- Add global option
config.trigger_hookups_without_authorization
(defaults totrue
to be compatible with previous versions)
-
Add missing imports of required third-party gems
-
Add policy chain
before_model_save
for model operations -
Add policy chain
before_nested_model_ops
for model operations -
If existing, use
ActiveSupport::ParameterFilter
overActionDispatch::Http::ParameterFilter
which is deprecated in Rails 6 -
Fix error catching of nested model operations
-
Fix error handling of sub operations
-
Add
view
to operation contexts that contains theview_context
. Only use this for frontend operations that are always called from within a controller. -
Expose
op_context
as a view helper method. This is useful for instantiating new (view) operations from within views and helpers.
- Fix mass assignment protection errors under Rails 3
-
Fix reliance on
ActionController::Parameters
. Now the strong parameter check is only enforced ifActionController::Parameters
actually exists. -
Fix missing
require
-
Fix compatibility with ruby <
2.3.0
- First stable release after being battle-tested over an extended period of time.
- Add method
authorize_called!
to manually mark authorization as called for a specific operation.
- Fix bug with jRuby 9.2 where operation class name got mutated when inspecting it (see jruby/jruby#5480).
- Explain how to setup load paths in readme
- Exclude param named
escape
fromop_params
.
- Exclude param named
_
fromop_params
. This allows to usecache: false
withjQuery.ajax
.
-
Allow model name override for all models using
RailsOps::ModelMixins
. This means you can also specify a model name for models not inheriting fromRailsOps::VirtualModel
, i.e.:model User, 'ModelNameOverride'
- Keep stack trace on exceptions rethrown by
with_rollback_on_exception
.
- Make sure that original state is always restored after calling
RailsOps.without_authorization
, even in case of an exception.
- #2 Get rid of protected attributes functionality
- Fix #6 Exceptions in profiler are not re-thrown
- Fix #5 Measure for object_id ... not finished
- Fix a bug where nested models are saved at build time in update operations in some cases.
- Fixed log subscription
-
Added rubygems badge to readme
-
Corrected gem summary
-
Initial version as extracted from project
-
Start of change log