Skip to content

Being able to initialise a fully populated ROM::Struct #610

@mereghost

Description

@mereghost

ROM::Structs have albeit having a schema (defined by query returns if I got it right) don't allow you to use them for initialisation.

# table authors (name:string, id:integer, created_at:datetime, updated_at:datetime)
class Author < ROM::Struct ; end
Author.new(name: 'Bob') # => <Author {}>

This makes it hard to test pieces of your code without touching the DB at all and therefore slowing the testing down. Is it possible to offer some similar functionality (maybe as part of rom-sql :/ )?

Author.new(name: 'Bob') # => <Author {name: 'Bob'}>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions