Version 0.2.0
Pre-releaseActions
Implemented #transaction method.
Refactored how actions handle required parameters.
-
The validation errors for the
CreateandUpdateactions are now scoped by the resource name. The error path should now match the relative path of the corresponding form field. -
(Breaking Change) Action constructors no longer accept
:repositoryor:resourcekeywords by default. -
(Breaking Change) Actions now require a
:repositorykeyword when called, and can accept arbitrary keywords. -
(Breaking Change) Resource actions now require a
:resourcekeyword when called.
Middleware
- Defined
Actions::Middleware::Associations::Findfor querying associations. - Defined
Actions::Middleware::Associations::Parentfor querying a parentbelongs_toassociation. - Defines
Actions::Middleware::LogRequestfor logging request details. - Defines
Actions::Middleware::LogResultfor logging the action result.
Collections
Implemented Collection#qualified_path, and added qualified path support to Repository.
Commands
Commands now handle invalid SQL statement exceptions by returning a failing result with a StatementInvalid error, rather than raising the exception.
Controllers
Implemented .build_request class method.
Implemented .default_format configuration option.
Refactored Cuprum::Rails::ControllerAction to Cuprum::Rails::Controllers::Action.
- (Breaking Change) Controller actions now require a
:controllerargument when called.
Middleware
Implemented controller middleware.
Cuprum::Rails::Controllers::Middleware.Cuprum::Rails::Controllers::ClassMethods::Middleware.
Updated Cuprum::Rails::Controllers::Action to apply configured middleware.
Requests
Added #context method to access the original request controller or context.
Added #member_action? method to identify requests to resourceful member actions.
Added #native_session method to lazily access the native controller session.
Added #properties method to access all request properties as a Hash.
Added #path_params method and properly handle parameters from the request path.
(Breaking Change) Renamed #method property to #http_method.
Resources
Automatically generate a Cuprum::Rails::Collection when creating a resource with a record_class but no explicit collection.
Added #actions option, which is automatically generated for singular and plural resources.
Added #parent option and associated #ancestors and #each_ancestors methods.
- (Breaking Change) Removed
Resource#collection.
Responders
Implemented Responders::Html::Resource to handle both singular and plural resources.
Cuprum::Rails::Responders::Html::PluralResourceis now deprecated.Cuprum::Rails::Responders::Html::SingularResourceis now deprecated.
Updated JsonResponder to display full error messages in the development environment.
Extracted Responders::BaseResponder.
Extracted Responders::Html::Rendering.
(Breaking Change) Responders now require :controller and :request parameters on initialization.
Responses
Implemented Responses::HeadResponse.
Implemented Responses::Html::RedirectBackResponse.
Added Rails flash message support to HTML responses:
Responses::Html::RedirectBackResponse.Responses::Html::RedirectResponse.Responses::Html::RenderResponse.
Results
Implemented Cuprum::Rails::Result, which includes a #metadata property for passing contextual data such as an authentication session or page configuration.
Routes
Route helpers not accept a wildcards hash for populating route wildcards, as an alternative to calling routes.with_wildcards.
Member route methods now accept a primary key value as well as an entity, or allow the key to be passed as part of the wildcards.
RSpec
Implemented contracts for Cuprum::Rails actions:
Cuprum::Rails::RSpec::Contracts::Actions::CreateContractsCuprum::Rails::RSpec::Contracts::Actions::DestroyContractsCuprum::Rails::RSpec::Contracts::Actions::EditContractsCuprum::Rails::RSpec::Contracts::Actions::IndexContractsCuprum::Rails::RSpec::Contracts::Actions::NewContractsCuprum::Rails::RSpec::Contracts::Actions::ShowContractsCuprum::Rails::RSpec::Contracts::Actions::UpdateContracts
Contracts allow libraries or applications to verify their actions implement the action specifications.
Defined Cuprum::Rails::RSpec::Contracts::SerializersContracts:
ShouldSerailizeAttributesContract: Verifies that the specified attributes are serialized with the expected values.
Implemented Cuprum::Rails::RSpec::Matchers::BeAResultMatcher, which adds support for a #metadata property to the be_a_result matcher.
- (Breaking Change) Existing contracts were moved into the
Cuprum::Rails::RSpec::Contractsnamespace and are scoped by type.COMMAND_CONTRACTis nowContracts::CommandContracts::ShouldBeARailsCommandContract.DEFINE_ROUTE_CONTRACTis replaced withContracts::RoutesContracts::ShouldDefineCollectionRouteContractandShouldDefineMemberRouteContract.
Serializers
Implemented Cuprum::Rails::Serializers::Context.
- Refactored serializers to take a
context:keyword instead ofserializers:.
Implemented Cuprum::Rails::Serializers::Json::PropertiesSerializer.
- Refactored
AttributesSerializerto inherit fromPropertiesSerializer. This is a breaking change for certain serializers with a block passed to.attribute.