Release 0.7.0
Overview
This release was hard and pretty long. As a result we've got a set of very important features (like polymorphic relations and complex query update mechanism). Also as a side effect bunch of side-shards were appeared to fill gaps in missing functionality (like form parsing).
Also you can find 3 sample application describing possible way of integrating web frameworks/libraries with Jennifer:
Changelog
General
- bump
sam
to"~> 0.3.0"
- add sam command
generate:model
to generate model and related migration - move all logic regarding file generating to
Jennifer::Generators
space - add
db:seed
task as a placeholder seeding task db:setup
now invokesdb:seed
afterdb:migrate
QueryBuilder
- add
#and
,#or
and#xor
shortcut methods toExpressionBuilder
Criteria#in
now acceptsSQLNode
as well- add
Statement
module with base abstract functionality needed for query string generating ExpressionBuilder#g
and#group
now has no argument type restrictionGrouping#condition
now can be ofStatement
typeQuery
includesStatement
Query#to_sql
now is#as_sql
,#select_args
-#sql_args
Condition
includesStatement
Executables#update
accepts block expectingHash(Symbol, Statement)
to be returnedExecutables#modify
is removed in favor of new#update
method accepting block- now
LogicOperator
is inherited fromSQLNode
#delete
andexists?
ofExecutables
do nothing when#do_nothing?
istrue
- add
Query#do_nothing?
- add
Query.null
which returnsQuery.new.none
Join
acceptsGrouping
forON
condition
Model
- remove
Base.build_params
,Base.parameter_converter
methods - remove
ParameterConverter
class - fix skipping generating default constructor by
Mapping.mapping
when at least one field has default value and all others are nilable stringified_type
option is removed from theCOLUMNS_METADATA
STIMapping#arguments_to_save
&STIMapping#arguments_to_insert
now respect field converterTranslation
model now is includeable module- all class methods of
Translation
are moved toTranslation::ClassMethods
which is automatically extended by target class usingincluded
macro #lookup_ancestors
and#human_attribute_name
methods ofTranslation
are addedErrors#base
now is type ofTranslation
instead ofBase
- add
Base#persisted?
- now attribute-specific rendering for
Resource#inspect
is generated by.mapping
- add polymorphic relation support for
has_one
,has_many
andbelongs_to
relations - add
:nodoc:
for almost all generated relation methods (except#association
) - add missing relation names for criterion in
Relation::Base
methods - add
Relation::IPolymorphicBelongsTo
,Relation::PolymorphicHasMany
andRelation::PolymorphicHasOne
@new_record
,@destroyed
,@errors
, changeset and relation attributes now is ignored byJSON::Serializable
- add
skip_validation
argument toAuthentication.with_authentication
macro to specify whether validation should be added - add generating predicate method
#{{attribute}}?
for boolean attribute - allow
Jennifer::Model::Base#attribute=
to accept not only defined type but alsoJennifer::DBAny
- rename
Base#update_attributes
toBase#set_attributes
Validation
- all validation macros now accept
:if
key; the value may be bothSymbol
name of a method to be called or expression - replace validation logic generated during a macro call with new validators usage:
Validations::Absence
,Validations::Acceptance
,Validations::Confirmation
,Validations::Exclusion
,Validations::Format
,Validations::Inclusion
,Validations::Length
,Validations::Numericality
,Validations::Presence
,Validations::Uniqueness
- remove
Jennifer::Validator
in favour ofJennifer::Valdiations::Validator
- all validators by default implement singleton pattern
- all validation macros are moved to
Jennifer::Validations::Macros
View
- now attribute-specific rendering for
Resource#inspect
is generated by.mapping
- add generating predicate method
#{{attribute}}?
for boolean attribute
Adapter
- fix output stream for postgres schema dump
- remove legacy postgres insert
- add
Adapter#foreign_key_exists?
- add
Mysql::SchameProcessor
- now
Base#schema_processor
is abstract - add
Postgres::SchemaProcessor#rename_table
SchemaProcessor
now is abstract class- all builder methods are moved from
SchemaProcessor
class toTableBuilderBuilders
module - fix syntax in
SchemaProcessor#drop_foreign_key
- all
_query
arguments inBase
methods are renamed toquery
Base.extract_arguments
is removed.delete
,.exists
and.count
ofBaseSQLGenerator
now returns stringPostgres.bulk_insert
is removedTransaction#with_connection
ensure to release connection- all sqlite3 related code are removed
Config
- fix
migration_failure_handler_method
property from being global - add new property
model_files_path
representing model directory (is used in a scope of model generating) - fix ignoring
skip_dumping_schema_sql
config
SqlGenerator
.select_clause
now doesn't invoke.from_clause
under the hood.lock_clause
adds whitespaces around lock statement automatically
Migration
- remove
Runner.generate
andRunner::MIGRATION_DATE_FORMAT
TableBuilder::CreateTable#reference
triggers#foreign_key
and acceptspolymorphic
bool argument presenting whether additional type column should be added; for polymorphic reference foreign key isn't added
Exceptions
- 'RecordNotFound' from
QueryBuilder::Query#first!
andQueryBuilder::Query#last!
includes detailed parsed query