- Conditionally monkey patch deep_dup for Rails 3.2 support.
- Debug log message fix.
- Caches resource in query includes to avoid additional query(ies). Thanks to Tommy for noticing!
- Renamed restful_json to Irie. It isn't only about json.
Changes since restful_json v4.5.1:
- Now assumes Rails 4+ and uses Inherited Resources.
- Simplification of configuration, usage, and implementation.
- CanCan/authR support now optional via authorizer module.
- Removed direct support for Permitters. The controller can define params methods and/or use
before_action
. - Removed direct support for ActiveModel::Serializers. The controller can define serializer(s) in
valid_render_options
. - Removed exception handlers so can use default Rack exception handling or
rescue_from
. - Authorization support handled via separate module using
before_action
. - Added action-specific validation error handling methods.
- Added
can_order_by
. - Renamed
order_by
todefault_order_by
to clarify intent. - Removed
:with_default
option fromcan_filter_by
and replaced with methoddefault_filter_by
, because it is unlikely the same default value would be used with multiple predicates. valid_render_options
is now the way to specify render options.- Split action behavior into more methods to be easily overrideable.
- Removed
query_for
index action copying behavior and replaced withindex_query
. - Removed
with_query
oncan_filter_by
and replaced with methodcan_filter_by_query
. - No longer send (t) into query lambdas. If you need it in the lambda, use
resource_class.arel_table
. - Can rename or alias the request parameter names used for functions to avoid conflicts with attributes.
- Renamed functions to match relational counterpart: uniq -> distinct, skip -> offset, take -> limit.
- Predicate prefix is now
.
instead of!
. - Must intentionally include action methods, e.g.
include_actions :all
. supports_functions
replaced with intentionally include extension modules, e.g.include_extensions :paging, :order
likesupports_functions
. However,autoincludes
allows similar behavior before by automatically including configurable sets of modules for features that don't really do anything unless you call their class methods to configure.- Added self.update_should_return_entity to config.
- Changed model class and name related variables resource_class, collection_name, instance_name methods, similar to inherited_resources.
- Allow ability to get resource_class, etc. on controller class vs. only instance.
- Added debug option to enable debug logging in instance methods to help track execution without tracing/debugging.
- Config errors now Irie::ConfigurationError.
- Rework of url and path helpers.
- Support for configuring model-related attributes via
default
method with options somewhat similar to inherited_resources. can_filter_by
delimiting is now specified as an option:split
in thecan_filter_by
.- Probably many other changes. See the README.
- Changed
render_error
method name torender_rj_action_error
to avoid Rails conflict.
- Changed config:
rescue_handlers
->rj_action_rescue_handlers
,rescue_class
->rj_action_rescue_class
to avoid conflicts with rescue_from.
- Fix for "The method
.includes()
must contain arguments." Now does not call includes on the relation if empty. - Added
clean_backtrace
option to not clean backtraces inerror_data
if usingerror_handlers
. - Fixing Strong Parameters support for
(model name)_params
private method in Ruby 1.9.3/2.0.0. - If using Strong Parameters, create/update now defaults to looking for
(model name)_params
method in controller.
- Fix for including/includes_for
- No longer building for Rails 3.1.
- Documented workarounds for errors caused by including/includes_for; in some cases, incorrect SQL generated by Rails/AR when mix with joins for same tables.
- Made
serialize_action
callable twice; once for array serializer and once for each serializer, for array actions. - Added
additional_render_or_respond_success_options
anddefault_additional_render_or_respond_success_options
to allow custom logic for determination of serializers for an action. - Added
model_class_scoped
method to return@model_class.all
or@model_class.scoped
to hurdle deprecation.
- Added
includes_for
class method in controller to help avoid n+1 queries via calling.includes(...)
for a specific action. - Added
apply_includes_to_custom_queries
to config.
- Added
including
class method in controller to help avoid n+1 queries via callingincludes(...)
.
- Extracted permitters into separate gem with some changes. See Permitters project.
- Added
action_to_permitter
,actions_that_authorize
,allow_action_specific_params_methods
, andactions_that_permit
to config.
- Removing
rescue_from
's from DefaultController that would require additional controller methods if default error handling not used.
- Try to require 'active_record/errors' before referring to
ActiveRecord::RecordNotFound
in gem default config. - Don't add permitters to autoload path if RestfulJson.use_permitters is false in environment or initializer.
- Railtie that adds deprecated
acts_as_restful_json
support now being required. - Added activesupport runtime dependency to gemspec.
- Missing i18n key now defaults to error.message.
- Added
rescue_class
config option to indicate highest level class to rescue for every action. (nil/NilClass indicates to re-raise StandardError.) - Added
rescue_handlers
config option as substitute for having to rescue, log, set status and i18n message key for sets of exceptions. - Added
return_error_data
config option to also return the exception's class.name, class.message, and class.backtrace (cleaned) in "error_data" in error response.
- If debug config option true, controller/app will now log debug to Rails logger.
- Fixing bug: will return head: ok with no body on destroy for no errors in formats other than HTML, like it did in versions before restful_json v3.3.0.
- Using
.where(id: params[:id].to_s).first
in show/update/destroy,.where(id: params[:id].to_s).first!
in edit. - No more deprecated
find(id)
in show/edit.
- Removed unnecessary debug logging of permitter class, and now only outputs if can't find when debug on.
- Update and destroy use where instead of find and update 404's for missing record.
- Important fixes to recommendations around use of modules in doc.
- Removed unnecessary debug logging of serializer.
- Added
avoid_respond_with
config option to always use render instead ofrespond_with
. - Fixing bug in
serialize_action
. - Consolidated controller rendering.
- Better isolated controller and model changes, made model changes for Cancan and Strong Parameters something that needs to be done in configuration.
- Tests for Rails 3.1, 3.2, 4.
- Fixing bug in
order_by
. - Working on travis-ci config and appraisals/specs for testing Rails 3.1/3.2/4.0.
- Important change to README that should not use
acts_as_restful_json
in parent/ancestor class shared by multiple controllers, because it is unsafe. - Fixing bug in delete related to custom serializer when using AMS.
- Made ActiveModel::Serializers, Strong Parameters, Permitters, Cancan all optional.
- Added support for strong_parameters without Permitters/Cancan, allowing *_params methods in controller.
- Fixing double rendering bug on create in 3.1.0.
- Added ActiveModel::Serializers custom serializer per action(s) support.
- Added JBuilder support.
- Fixing gemspec requirements to not include things it shouldn't.
- Updated
order_by
, comments.
- Controller with declaratively configured RESTful-ish JSON services, filtering, custom queries, actions, etc. using strong parameters, a.m. serializers, and Adam Hawkins (twinturbo) permitters