Today Jennifer doesn't support Model.new or Model.build without any attributes nor with a sub-set of required attributes. Is this by choice or something that slipped through?
Example:
class User < Jennifer::Model::Base
with_timestamps
mapping(
id: Primary32,
name: String,
created_at: Time?,
updated_at: Time?,
)
end
User.new({:name => "Jennifer"})
Unhandled exception: Column User.age can't be casted from Nil to it's type - Int32 (Jennifer::DataTypeCasting)
from src/models/user.cr:4:3 in '_extract_attributes'
from src/models/user.cr:4:3 in 'initialize'
from src/models/user.cr:4:3 in 'initialize'
from src/models/user.cr:4:3 in 'new'
from .icr_cRpmabygCPTixNpJwNqrZA.cr:13:3 in '__icr_exec__'
from .icr_cRpmabygCPTixNpJwNqrZA.cr:16:26 in '__crystal_main'
from /opt/homebrew/Cellar/crystal/1.3.2/src/crystal/main.cr:115:5 in 'main_user_code'
from /opt/homebrew/Cellar/crystal/1.3.2/src/crystal/main.cr:101:7 in 'main'
from /opt/homebrew/Cellar/crystal/1.3.2/src/crystal/main.cr:127:3 in 'main'
User.new
^--
Error: wrong number of arguments for 'User.new' (given 0, expected 1..2)
Overloads are:
- User.new(values : Hash | NamedTuple, new_record : Bool)
- User.new(values : Hash | NamedTuple, new_record)
- User.new(pull : DB::ResultSet)
- User.new(values : Hash(Symbol, AttrType) | NamedTuple)
- User.new(values : Hash(String, AttrType))
Today Jennifer doesn't support
Model.new
orModel.build
without any attributes nor with a sub-set of required attributes. Is this by choice or something that slipped through?Example: