Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 17:23
    jodosha synchronize #1082
  • 17:23

    jodosha on circle-ci

    Fix CI (compare)

  • 15:08
    plrthink starred hanami/view
  • 13:35
    jodosha commented #1082
  • 07:49
    aren55555 starred hanami/hanami
  • Oct 20 20:48
    evgeniy-lvov starred hanami/controller
  • Oct 20 19:43
    alexandr-senyuk starred hanami/hanami
  • Oct 20 18:47
    kaikuchn commented #1082
  • Oct 20 13:23
    jodosha synchronize #1082
  • Oct 20 13:23

    jodosha on circle-ci

    I really hope this indentation … (compare)

  • Oct 20 13:20
    jodosha synchronize #1082
  • Oct 20 13:20

    jodosha on circle-ci

    Fix indentation (hopefully) (compare)

  • Oct 20 13:17
    jodosha synchronize #1082
  • Oct 20 13:17

    jodosha on circle-ci

    Ehm.. don't install builder gem… (compare)

  • Oct 20 12:58
    jodosha synchronize #1082
  • Oct 20 12:58

    jodosha on circle-ci

    Fix intendation of Circle CI co… (compare)

  • Oct 20 12:57
    jodosha synchronize #1082
  • Oct 20 12:57

    jodosha on circle-ci

    Install `builder` gem on Circle… (compare)

  • Oct 20 11:54
    jodosha synchronize #1082
  • Oct 20 11:54

    jodosha on circle-ci

    Remove logical ANDs from script… (compare)

Kai Kuchenbecker
@kaikuchn

Ok, so this is the road map for hanami 2.0: https://trello.com/b/lFifnBti/hanami-20 You can follow @timriley's blog (https://timriley.info/) if you want to have a more detailed view on his personal progress with items from the road map. You can also check out his application template if you want to get started with hanami 2.0 now (https://github.com/timriley/hanami-2-application-template) he's using hanami 2.0 right now at the company he's working for, but warns that there's gonna be some degree of disruption. They do use it for 3 production apps though. But be warned, @parndt tried to get started and struggles with it a lot. He's promised to work on a getting started guide as a result of his struggles, but there is none yet!

People think that 2.0 is gonna be a 2021 Release but no promises. Stable versions of usable pieces may be released gradually, e.g. hanami-api or hanami-model.

Your continued interest has triggered the intent to finally write up a blog post about the status, goals, etc. probably with a Q&A, I'll let you folks know here when that happens. :)

Sven Schwyn
@svoop
@kaikuchn This is very helpful news, thank you! I'll keep an eye on the resources you've mentioned. I understand the changes from Hanami 1 to 2 are pretty major, so since I'm Rails senior but new to Hanami, what's your opinion on the following question: Does it make sense to study the Hanami 1 guides and code in depth now and then take it from there as parts of 2 become stable? Or are the differences so profound, it'd be a better idea to just skim over the Hanami 1 guides and wait for the new guides before diving into the code?
Kai Kuchenbecker
@kaikuchn
I think that familiarity with the dry-rb gems will be most helpful (https://dry-rb.org/). I suspect that many concepts from dry-rb will be present in hanami 2.0 since dry-rb, rom and hanami folks are working closely together on this. I know that the framework itself will be using dry-rb/container for instance, will it be helpful to have an understanding of dry-rb/container when using hanami 2.0? Maybe not for usual tasks but if you're debugging something, or encounter a limitation of the framework I'm sure it will help.
Other things like dry-validation will definitely be helpful to know. I suspect that it will be present again in hanami 2.0 since it's just a very good way to define and perform validations.
Apart from that looking over the getting started guide from hanami 1.0 may give you a glimpse of where we came from and some concepts are likely to stay. Although I cannot say with certainty which.
Sebastjan Hribar
@sebastjan-hribar

I have a question about designing a REST API endpoint that would accept post requests.
We're building a middleware (call it M for brevity) that seats between a data provider (call it A) and data consumer (call it B). Here is the workflow:

  1. A user enters an ID in M and triggers the process.
  2. M calls A and gets the data.
  3. M sends the data to B.
  4. B uses the data to create an entity.

So the middleware might be used by a variety of B apps that all need to get the data from A. Due to constraints we need M and can't setup direct communication between A and B.

For the POC we need a test B app. My question is how to approach this. My high level picture is a REST endpoint in B that calls an interactor to create an entity. If this is correct, can someone help with some guidelines for the endpoint?

Sebastjan Hribar
@sebastjan-hribar
What is the correct way of whitelisting a param, that is optional? If I follow the simplest example of required(:some_param).filled it will not pass it through. And omitting .filled results in nil if the param contains a value.
Kai Kuchenbecker
@kaikuchn
use optional I guess? See Usage in this section of the guide https://guides.hanamirb.org/actions/parameters/#validations-coercion
Regarding your other question I have reservations about calling another services synchronously during a http request cycle, especially on every request. Do you own that other service? Otherwise do you have any guarantees on response times? Or will you timeout after 100ms?
Kai Kuchenbecker
@kaikuchn
I'm not saying "don't do it" since it's pretty normal to call services (e.g., your database, or cache) within a request cycle, but it needs to be fast.
Sebastjan Hribar
@sebastjan-hribar
@kaikuchn Thank you for both inputs. I don't know how 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?
Sebastjan Hribar
@sebastjan-hribar
To add to the explanation, we already have the first two points in the workflow setup and calls to A and its responses are really fast.
Edouard
@inouire_twitter
Hello folks, just wanted to let you know that we deployed a customer app this week, Hanami powered :rocket: https://products.wondergrip.com (the "products" part of their website)
All our plateform is also Hanami based, but it's 100% private so harder to show it to you...
This framework is pure gold
Sebastjan Hribar
@sebastjan-hribar
@inouire_twitter :fireworks:
Klaus Heissler
@claudiug
there is any way to generate a new project --api way? like the structure, and models but i dont need the views :)
Sebastjan Hribar
@sebastjan-hribar
@claudiug You can pass the --skip-view when generating an action.
Sebastjan Hribar
@sebastjan-hribar
I'm getting 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.
Any idea why this happens?
Sebastjan Hribar
@sebastjan-hribar
This happens with AJAX request, not the standard form. I found some older questions here regarding this and 1 github issue that should fix this, but I don't know how to work around this.
Sebastjan Hribar
@sebastjan-hribar

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?

Ryan Yang
@YangJie6020
Hi, I am a beginner hanami user. When I learn the hanami framework from the tutorial. I got this problem: ''' uninitialized constant BetterErrors::Middleware::VERSION'''. I don't know how to fix it.
Tran Anh Vu
@Vuta

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

ippachi
@ippachi
thatguysimon
@thatguysimon
Hi all,
Is there a way to traverse an app's routes? I know about Web.routes but I couldn't find a way to iterate over it.
Danny Santos
@DannySantos

@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.

Julien ITARD
@JulienITARD_twitter
Hello ! I'm a rails dev and i'm learning DDD. I've read that Hanami is a good framework to apply DDD. Do you have any useful links ? thanks !
thatguysimon
@thatguysimon
Thanks @DannySantos, I eventually figured out this same way as well.
Still hoping to find a public interface for this though..
Kai Kuchenbecker
@kaikuchn
There isn't a public interface for that, probably because one wouldn't usually iterate over all routes but only match for specific routes.
thatguysimon
@thatguysimon
@kaikuchn it could be super useful for building tools for autogenerating things like documentation, OpenAPI specs, etc...
yahorbukhta
@yahorbukhta
image.png
Hi, after command " bundle exec hanami db prepare" I get an error :(
Jeff Dickey
@jdickey
:+1: on the idea for traversing routes as part of find-and-document iteration for doc generation. Anything (that doesn’t fundamentally break software) that helps automate documentation is almost by definition a Good Thing. Manual document generation too rarely gets done with any quality
Kai Kuchenbecker
@kaikuchn
Interesting use case, you could open an issue on github and propose this to the team.
thatguysimon
@thatguysimon
@kaikuchn I might even have a go at it myself.. but does it make sense to do it now for 1.3 when 2.0 is already in the horizon?
Paweł Świątkowski
@katafrakt
@yahorbukhta this is an expected error, everything worked
glaszig
@glaszig
hello, somebody here?
Edouard
@inouire_twitter
@JulienITARD_twitter did you have a look that the official doc? https://guides.hanamirb.org/introduction/getting-started/
@glaszig yes ?
glaszig
@glaszig
thanks @kaikuchn for the ostruct pointers a few weeks back. still, i'm looking for a definitve answer to the question if using 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.
Sven Schwyn
@svoop
Hi folks! To follow the work on Hanami 2, is the unstable branch the right place to go? https://github.com/hanami/hanami/blob/unstable/hanami.gemspec
thatguysimon
@thatguysimon
@svoop I think the best place would be the public trello board: https://trello.com/b/lFifnBti/hanami-20
Unless you want to see actual code..
Sven Schwyn
@svoop
@thatguysimon Sorry for the confusion, I ment "follow the work on Hanami 2 code" rather than the roadmap on Trello.
thatguysimon
@thatguysimon
Is Hanami participating in Hacktoberfest? https://hacktoberfest.digitalocean.com/
Paweł Świątkowski
@katafrakt
@svoop yes, unstable is where hanami 2 happens
Sebastjan Hribar
@sebastjan-hribar
How would I get the controller for each action?
Sebastjan Hribar
@sebastjan-hribar
The use case for getting the controller info is a before call for each action to see if the user is authorized.
Vítor Avelino
@vitoravelino
hi! anyone knows open source apps that are still being maintained? the ones I find are usually abandoned or stagnant.