Forum https://discourse.hanamirb.org – Code of Conduct http://hanamirb.org/community/#code-of-conduct
depfu[bot] on update
depfu[bot] on update
Update dry-types to version 1.5… (compare)
depfu[bot] on update
Update dry-struct to version 1.… (compare)
OpenStruct
during runtime still invalidates method cache and/or impairs performance. i'm seeing newer blog post where ostruct is being used during runtime which makes me wonder if something changed.
Hi. Please help me to understand how to organize my architecture better. Imagine I have a feature that requires to touch several repositories, models and so on. For example, I have a function CreateTransaction(from_account, to_account, amount)
which does the next things: create debit Transaction on to_account, create credit Transaction of from_account. This operation has some restriction: the amount cannot be 0 or negative, the accounts should be different and so on. So, I need some validations.
The validations are described only in scope of actions (I like having data validations dependent on ,let's say, the protocol level). But of course the CreateTransaction logic must not be implemnted in an action as it might be used from several protocols: from web gui, from json API, from protobuf api and so on
But of course I can create just my own class with an instance method "call" and put some if
conditions:
class CreateTransactionOperation
def initialize(from, to, amount)
end
def call
return :error_1 if amount <= 0
return :error_2 if from == to
begin_transaction
bla bla bla
bla bla
commit_transaction
end
end
and it will work obviously.
get "/users", to: Actions::V1::Users::Index.new
Actually the team is working hard on v2
Sure! But why it's like invisible for the others?
https://github.com/hanami/hanami/releases/tag/v2.0.0.alpha1
30 Jan 2019
self.body=
setter doesn't seem to work. This works. Feels like I'm not doing something correctly, though