Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 18 09:43
    cabb starred hanami/hanami
  • Aug 18 09:39
    C-Band starred hanami/hanami
  • Aug 17 19:04
    ehannes starred hanami/hanami
  • Aug 16 18:31
    vishaldeepak starred hanami/hanami
  • Aug 16 17:34
    philipsjp26 starred hanami/hanami
  • Aug 16 13:55

    timriley on v2.0.0.beta2

    (compare)

  • Aug 16 13:52

    timriley on main

    Prepare for v2.0.0.beta2 (#1200) (compare)

  • Aug 16 13:52

    timriley on prepare-for-v2.0.0.beta2

    (compare)

  • Aug 16 13:52
    timriley closed #1200
  • Aug 16 13:34

    timriley on v2.0.0.beta2

    (compare)

  • Aug 16 13:33

    timriley on prepare-for-v2.0.0.beta2

    (compare)

  • Aug 16 13:33

    timriley on main

    Prepare for v2.0.0.beta2 (#226) (compare)

  • Aug 16 13:33
    timriley closed #226
  • Aug 16 13:24
    timriley synchronize #1200
  • Aug 16 13:24

    timriley on prepare-for-v2.0.0.beta2

    Prepare for v2.0.0.beta2 (compare)

  • Aug 16 13:16
    timriley commented #1201
  • Aug 16 12:14
    timriley milestoned #1201
  • Aug 16 12:14
    timriley assigned #1201
  • Aug 16 12:14

    timriley on fix-location-of-rack-require

    (compare)

  • Aug 16 12:14

    timriley on main

    Move require for rack inside to… (compare)

ippachi
@ippachi
@timzzzhou_gitlab
I using Hanami with puma in production.
In my case, I added puma Gemfile and create puma.rb normally, and CMD ["bundle", "exec", "puma"].
1 reply
Dino Koutrouzas
@dino-koutrouzas

Hi all. I am wondering if anyone has done/is doing application-level encryption à la Active Record Encryption https://guides.rubyonrails.org/active_record_encryption.html

I am looking to add most of the feature set of AR Encryption to our application.

1 reply
Seb Wilgosz
@swilgosz
Hi all, just in case you are interested, I have added source code links to all my Hanami Mastery episodes. You may access Hanami 2 example applications easily directly from any related article. Feel free to check it out! https://hanamimastery.com/episodes
Bucky Wolfe
@Igneous
Has anyone tried to use hanami new to create an app name with a period in it? The scaffolder seems to create everything as expected, but require_relative bars because ../lib/whatever.whatever has a period in the path
Hannes Elvemyr
@ehannes

Hi!

I'm having Content Security Policy problems with the Hanami 2 template project. Anyone here that could give a hint on what's wrong? :)

I'm trying to getting started with Hanami. We're hopefully going to use it in a new client project soon so we thought we should have a go and see if we can get it up and running.

I'm using a quite recent version of the Hanami 2 template https://github.com/hanami/hanami-2-application-template. I have a slightly different tool set than the one suggested in the readme. So I'm starting the project with the following:

./bin/install hello_hanami
yarn
yarn run start
# in another shell
bundle exec guard --no-notify --no-interactions

The asset server is up and running at localhost:8080. The application server is also up at port 3000 and displays correct content, but it doesn't load any assets. I get errors regarding the Content Security Policy:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“default-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:8080/assets/main/public.css (“default-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:8080/assets/main/public.js (“default-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:3000/favicon.ico (“default-src”).
3 replies
Olaoluwa Afolabi
@AfolabiOlaoluwa
Hi, I am trying to use Hanami for a production-based API solution. I would like to know if there is any template for API? Something like the web version https://github.com/hanami/hanami-2-application-template. Or are there any thorough resources you want to point me to regarding making API with Hanami?
10 replies
Damian C. Rossney
@dcr8898_gitlab
image.png
The Stack Overflow developer survey is open. Feel free to bump Hanami! 😎
https://stackoverflow.blog/2022/05/11/stack-overflow-2022-developer-survey-is-open/.
Errin Larsen
@errinlarsen

I'm having some issues trying to utilize a params block in an Action within hanami-2-application-template. If I include the block, I receive an error: NoMethodError: undefined method 'params' for Main::Actions::Characters::New:Class

... digging into the code a bit, it appears that Hanami::Action:Validatable, which includes the params(klass = nil, &blk) definition, is only included in Hanami::Action::StandaloneAction (which itself is included in Haname::Action) if Validatable is already defined: https://github.com/hanami/controller/blob/v2.0.0.alpha6/lib/hanami/action/standalone_action.rb#L55

...it seems to me I just need to add the correct gem to my Gemfile, or require the right library file (hanami/action/validatable?) in the right source file, or something simple like that.

Any help?

Errin Larsen
@errinlarsen
I think I got past that by adding hanami-validations to my Gemfile, but now I've got issues with routes... back to it!
3 replies
Jonas Schubert Erlandsson
@d-Pixie

I have a question about the Hanami.application global. After digging through the code and testing it seems like this way of keeping a global reference to the app means that you can have only one Hanami instance running at once? So if I wanted to run two Hanami apps mounted at different paths in Sinatra, could I?

I'm not asking because I have that particular use case, but I am trying to solve some of the same problems that Hanami have solved and this is the final thing I'm stuck on. It might not be a problem for Hanami - normally you would just run a single instance anyway. But I'm building a REST API abstraction library and this global reference (if I understand it correctly) means that end users would not be able to have two API libraries based on my abstraction loaded at the same time - they would both try to use the global and get into a conflict, the same way you would if you tried to load two Hanami apps at once now.

Or am I missing something? :slight_smile:

1 reply
Dmitry Matveyev
@greenfork
hi, I was wondering if there's still an effort for service object, I remember there was Hanami::Interactor some time ago. but I can't find it in the 2.0 version
Lairan
@alex-lairan

@greenfork Prefer real object domain instead of procedural "service object".

Hanami 2 has a very simple way of creating a rich domain thanks to dry-system.

Dmitry Matveyev
@greenfork
@alex-lairan thanks, that is new to me! controversial topic indeed :)
Armin
@wuarmin
@greenfork check out dry monads. I think this is what you searched for.
Armin
@wuarmin
@alex-lairan Hanami still recommends the functional service object approach, right?
David Silva
@Davidslv
Hello all, I never have used hanami before but today is the day I'm giving it a try. Right now I only have one question: is it possible to start a new project without having mailers added by default? Or should I just delete code, folders and files (is it ok to do that?)
I was hoping I could just do it through the new command like I did with the rest of the options: hanami new pistachio --test=rspec --database=postgres --template=erb
Seb Wilgosz
@swilgosz
@Davidslv If you are trying it for the first time, I would suggest to try Hanami 2 app template. We have view helpers and cli generators missong yet though.
Lairan
@alex-lairan
@wuarmin rich domain does not mean no functional
it means the domain can handle itself without app (controller) and infra (repo/relations)
So thank this you can unit test all your domain without any mock db
Armin
@wuarmin
@alex-lairan rich domain model means that the models contain the logic, right? Anemic model domain means that the models are only data holders that are changed by e.g. service objects. I like the Anemic model domain approach: The side effects happen in the service-objects and the domain can handle itself too. The logic is in the service-objects (synonym of interactor) and the models are passed as parameters. A controller just calls the service-object, e.g. UpdateUser.new.call(user). With this approach you can also unit-test the domain without mocking the db.
Lairan
@alex-lairan

rich domain model means that the models contain the logic

Not in a functional way, you have your data and the module logic is the "owner" of this data.

That is how the rich domain is represented in functional.

Hanami allows us to design our code, takes all the advantages you can.
That's a big step comparatively of Rails that forces us in a MVC + RailswayTM

zhando
@zhando
I'm wandering back into ruby (and looking hard at elixir) after a very long absence. I remember reading a few articles back then that outlined a "better" approach to programming for the web than MVC.. I remember reading that and thinking wow.. they're on to something there.. something that was a lot different than rails but more natural to what the web actually is.. and therefore more performant.. I remember that led me to dry-rb and hanami.. So I guess I'm looking for those type of articles or blog posts again to refresh my memory.. Can anyone point to anything? Maybe this was 2016 or 2017..
zhando
@zhando
I believe the articles or blog posts back then may have mentioned roda as part of this newer approach..
Sean Collins
@cllns
@zhando Perhaps "Railway oriented programming"? Or "Hexagonal Architecture" (though the whole point of that is that it's not web specific)
Damian C. Rossney
@dcr8898_gitlab
@zhando Here's a bunch of links for you! ;-) To start with, taking a bird's eye view of architecture, you might want to read about Hexagonal Architecture (original article by Alistair Cockburn is currently available from the Internet Archive or Wikipedia); or Onion Architecture; but similar ideas are laid out most clearly by Robert C. Martin in his presentations on Clean Architecture (article and excellent talk--you can find other versions of this talk).
Damian C. Rossney
@dcr8898_gitlab
@zhando More specifically, I think you were probably referring to the posts by Tim Riley, now a Hanami and Dry-rb core team member. I would try to read everything he has written, along with anything by Piot Solnica. Here is an article by Tim Riley (possibly the one you are thinking of) and a talk. Here's a dose of Piotr Solnica, but you can read a lot more there. Here's a recent talk he did on Hanami. Obviously, you should seek out talks and articles by Luca Guidi as well.
@zhando It seems clear that Hanami was influenced by Hexagonal/Clean Architecture, both in its approach and the terms it uses (interactors, entities, gateways). Not that these terms are unique, but they are used in Hanami in a way that is consistent with the ideas brought together by Robert C. Martin in his material (he does not claim to be the creator of any of these ideas, but distilled them from several sources to propose a general approach). Good luck!
zhando
@zhando
Thanks everyone! Excellent..
zhando
@zhando
And the Tim Riley articles had to be some of what I was reading back then. Thanks again.
Sebastjan Hribar
@sebastjan-hribar
Hi, we're still having issues with assets. In my dev environment everything works fine. When I deploy (still on my dev laptop) the app with Docker and using Hanami for serving static assets I get this in the console: Failed to load resource: the server responded with a status of 404 (Not Found) for a lot of assets. However, looking in the public\assetsfolder the different app folders have those assets that are reported missing.
I precompile in my docker-compose setup.
Could anyone help with this?
HotCoffeMug
@HotCoffeMug
hi, how can i switch from sinatra to hanami?
4 replies
Kris Leech
@krisleech
Hey, Our current codebase uses Rails, and would love to consider Hanami for a new product. I see version 2 is in alpha. I was wondering if there is any feeling as to when we might see a 2.x release, fully appreciating this is an open source project? Otherwise does anyone have any idea what a v1 -> v2 upgrade might look like if we where to go for v1 now?
4 replies
Seb Wilgosz
@swilgosz
@krisleech I strongly recommend to not start with Hanami 1x at this point. Next release of Hanami 2 should be beta already and we plan to upgrade our apps near the end of the year, but the effort is quite big, comparable to early major rails upgrades. I am personally waiting for first beta version to start my side project. Hope that helps!
Seb Wilgosz
@swilgosz
Hi, I am looking for some talk topic suggestions, wondering if there is anything you'd be interested in listening about (will be ecorded and published) https://twitter.com/sebwilgosz/status/1545052121942241286?s=20&t=OfQZVIhjxlrkdtdjPXEBRA
Luca Guidi
@jodosha
Armin
@wuarmin
Hey!
in the vacuum between Hanami 1.3 and Hanami 2, I implemented some API-only projects with hanami-api, dry-system and rom-rb. I'm very happy with it. I read that hanami-api may be dropped. It would be a shame for me if hanami-api were to be dropped. What should I do? I don't necessarily want to migrate these projects to Hanami 2, but they should evolve. What would you advise me?
Thanks a lot!
best regards
2 replies
Armin
@wuarmin
What are the pros and cons of using hanami router standalone vs hanami-api?
Pat Allan
@pat
Hi folks - just had dependabot open a PR to upgrade a project from alpha 8 to beta 1 🎉 … but, hanami db commands no longer seem to be present. Are they no longer available by default, and is there something I need to do to fix that?
7 replies
Marwan Rabbâa
@waghanza
Hi @jodosha,
Any time to give t the-benchmarker/web-frameworks#5234 ?
3 replies
Sebastjan Hribar
@sebastjan-hribar

Hi, we're still having issues with assets. In my dev environment everything works fine. When I deploy (still on my dev laptop) the app with Docker and using Hanami for serving static assets I get this in the console: Failed to load resource: the server responded with a status of 404 (Not Found) for a lot of assets. However, looking in the public\assetsfolder the different app folders have those assets that are reported missing.

I haven't gotten any further with this. For example, one of the assets not found when running in Docker is this one: http://localhost:8091/assets/sentinel/w3-1ac375ab06574a481efcf0b7fed82b4c.css. However, when I inspect the folder content I find it: /usr/src/app/public/assets/sentinel/w3-1ac375ab06574a481efcf0b7fed82b4c.css. What am I missing?

Sebastjan Hribar
@sebastjan-hribar
Also, I have the docker-compose run the hanami assets precompilecommand so everything is setup as described here.
And this happens for every app in the project. No assets are loaded/found.
Sebastjan Hribar
@sebastjan-hribar
There was an issue with the image. A clean setup solved it.