Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 09:56

    depfu[bot] on update

    (compare)

  • 09:56
    jodosha closed #613
  • 09:56
    jodosha assigned #613
  • Jan 24 17:16
    ivobenedito starred hanami/router
  • Jan 24 08:26
    Mukesh23singh starred hanami/view
  • Jan 22 20:22
    depfu[bot] labeled #613
  • Jan 22 20:22
    depfu[bot] opened #613
  • Jan 22 20:22

    depfu[bot] on update

    Update dry-types to version 1.5… (compare)

  • Jan 22 20:17
    depfu[bot] labeled #169
  • Jan 22 20:17
    depfu[bot] opened #169
  • Jan 22 20:17

    depfu[bot] on update

    Update dry-struct to version 1.… (compare)

  • Jan 22 17:59
    pzgz starred hanami/router
  • Jan 22 14:45
    bozhenaboichuk starred hanami/hanami
  • Jan 21 21:44
    jodosha commented #211
  • Jan 21 21:44
    jodosha milestoned #211
  • Jan 21 21:44
    jodosha labeled #211
  • Jan 21 21:43
    jodosha review_requested #211
  • Jan 21 21:43
    jodosha assigned #211
  • Jan 21 16:06
    geordidearns starred hanami/model
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.
Sebastián Delgado
@sebasdeldi
Hi guys
Yuriy Tsemashko
@azzz
Hi there!
Kuchaev Ilya
@Ilya-Kuchaev
Screenshot 2020-11-02 at 13.50.14.png
The project is somehow alive, but it's not very optimistic )
One year from the latest release!
Viktor
@skcc321
release per year is almost non maintained.
Edouard
@inouire_twitter
Actually the team is working hard on v2
Armin
@wuarmin

Actually the team is working hard on v2

:thumbsup:

Yuriy Tsemashko
@azzz

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

what would be is the right choice of how to implement my CreateTransaction?
as Hanami uses dry-rb a lot, I'm looking at dry-rb gem. I found dry-struct. If I include some validations into my class which extends Dry::Struct, i can build pretty nice business function

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.

Yuriy Tsemashko
@azzz
but is there a ready-to-use solution?
Brett Dudo
@dudo
Hello, folks! I've been working with hanami-api, and it's getting large. I'd like to move to controllers. Is that pretty straight forward? Anything to add to the initializers to auto require all the controller files?
to clarify, I'd like to do api + controllers
this example in the api readme is the only thing that touches on it get "/users", to: Actions::V1::Users::Index.new
Brett Dudo
@dudo
and where should I call Hanami::Controller.load!?
Brett Dudo
@dudo
image.png
image.png
tinkering with folder structure
image.png
Sebastjan Hribar
@sebastjan-hribar
@azzz we have a similar use case, where we had to implement touching multiple repos, doing some checks, catching exceptions and so forth. We now have all business logic for this in an interactor. For example, a request comes in through ajax to an action that calls this interactor. Have a look here to see how Hanami implements them. I find interactors to be a great way to organize such code.