Forum https://discourse.hanamirb.org – Code of Conduct http://hanamirb.org/community/#code-of-conduct
depfu[bot] on update
Update dry-types to version 1.5… (compare)
depfu[bot] on update
Update dry-struct to version 1.… (compare)
depfu[bot] on check
depfu[bot] on check
Pin concurrent-ruby to version … (compare)
optional
escaped me, I'll try to forget I've asked as soon as possible :smile_cat: . As for calling another service synchronously I'll discuss it with the team, but I don't see any other option given the circumstances. Right now, error/exception handling seems our best bet. So, assuming we will do it, how should we go about it? Like I described above?
Hanami::Action::InvalidCSRFTokenError: Hanami::Action::InvalidCSRFTokenError
after enabling sessions in application.rb
. The secret is defined in the .env.development. This is the only thing that causes the error since after disabling the sessions again the app works with no errors.
So from what I gather I can either 1. pass the csrf token with the json request as per here or 2. override the verify_csrf_token?
method as per here.
1: tried and it doesn't work, meaning the request doesn't go through. I also tried accessing the token explicitly with session[CSRF_TOKEN]
, but no success.
2: tried and it works, but I'm not sure if this approach is ok, well, safe.
Any other approach I missed?
hi guys,
I'm following this guide to upgrade hanami-validations
to 2.0.alpha
But when running bundle update hanami hanami-vadidations
, I got the error
Bundler could not find compatible versions for gem "dry-initializer":
In snapshot (Gemfile.lock):
dry-initializer (= 1.4.1)
In Gemfile:
hanami-validations (~> 2.0.alpha) was resolved to 2.0.0.alpha1, which depends on
dry-validation (~> 1.0) was resolved to 1.5.6, which depends on
dry-initializer (~> 3.0)
hanami-model (~> 1.3) was resolved to 1.3.2, which depends on
rom (~> 3.3, >= 3.3.3) was resolved to 3.3.3, which depends on
dry-initializer (~> 1.3)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Seems like hanami-model
and hanami-validations
are using different version of dry-initializer
. Can you guys kindly guide me through this please? TIA
@thatguysimon You need to get to the router. I’m not saying this is the way you should do it, but playing around in the console I managed to iterate over the routes by doing this:
routes = Web.routes.instance_variable_get(:@routes)
router = routes.instance_variable_get(:@router)
router.routes.each { |r| puts r }
There’s probably a more elegant way of getting there but you get the idea, you need to get to get to the Hanami::Routing::Route
class, which has enumerator methods on it.
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