Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 07:39
    thanhdatdev starred hanami/hanami
  • Dec 07 14:40

    jodosha on v2.0.0.alpha4

    (compare)

  • Dec 07 14:39

    jodosha on v2.0.0.alpha4

    (compare)

  • Dec 07 09:23
    wuarmin commented #394
  • Dec 06 12:44
    timriley commented #1133
  • Dec 06 12:43
    timriley synchronize #1133
  • Dec 06 12:43

    timriley on source-dir-config

    Use updated dry-system componen… (compare)

  • Dec 06 12:12
    timriley edited #1133
  • Dec 06 12:08
    timriley synchronize #1133
  • Dec 06 12:08

    timriley on source-dir-config

    Handle lib consistently like ot… (compare)

  • Dec 06 11:46
    timriley commented #359
  • Dec 06 11:45
    timriley commented #359
  • Dec 06 09:10
    wuarmin commented #394
  • Dec 06 09:10
    wuarmin commented #394
  • Dec 06 09:09
    wuarmin commented #394
  • Dec 06 02:17
    EugeneFelix starred hanami/hanami
  • Dec 04 00:44
    Blackmoses32 starred hanami/controller
  • Dec 03 19:08
    ianks commented #359
  • Dec 03 19:08
    ianks synchronize #359
  • Dec 03 17:56
    wholesomedonut starred hanami/hanami
Dino Koutrouzas
@dino-koutrouzas

@sebastjan-hribar had to do this the other day by using drop_constraint with the name of the constraint, which in our case was something like drop_constraint :table_name_first_column_second_column_key

https://sequel.jeremyevans.net/rdoc/classes/Sequel/Schema/AlterTableGenerator.html#method-i-drop_constraint

Brendan
@b-murphy

Hey All :wave:

I've recently hit an oddity with my spec within a newly create hanami app.

Basically we have controllers which will use the handle_exception => :do_a_thing

To test this we are using expect { action.call(params) }.to raise_error(exception, message)

Which works nicely; But the issue is that we can't seem to configure handle_exceptions correctly to false when running request specs; we've tried handle_exceptions ENV.fetch('HANDLE_EXCEPTIONS', true) and using allow(ENV).to receive(:fetch).with('HANDLE_EXCEPTIONS') But something within the pre-booting of the application.rb within this doesn't listen to this or something else we perhaps are missing?!

Having a dig though hanami's own specs we noticed hanami/devtools doing something to RSpec::Support::Env which looks like it would cover the case; but haven't explored yet; but seems like a relatively simple problem we perhaps have just missed!

Any help would be greatly appreciated!

Artemiy Solopov
@art-solopov
Hi all.
Sorry if this question is explained elsewhere.
Can I render a partial from a view/helper? render partial: partial_name in a helper method throws an ArgumentError.
Sebastjan Hribar
@sebastjan-hribar
@art-solopov I'm not sure what the problem would be, but we keep partials in apps\templates\shared, name them like _notice.html.erb and invoke them in the template like <%= render partial: 'shared/notice'%>.
Sebastjan Hribar
@sebastjan-hribar
I've put together a small blog post for how I use Tachiban. I'm comparing the use across my apps and I realized this is something that would be useful from the start, but I haven't put it in the readme.
Anyway, I hope it will be useful to someone else as well. I'll update if/when I find any errors and I'll write one for Rokku.
Seb Wilgosz
@swilgosz
Hi, I have published a short YT video guide about mapping Rails to Hanami, it may help to quickly grasp basic hanami concepts for people coming from the Rails world:).
Jeffrey 'jf' Lim
@jf
does anybody know if there is a way to get a list of all the entities defined in Hanami?
Seb Wilgosz
@swilgosz
Don't know if there is any shortcut but here are few ideas https://stackoverflow.com/questions/2393697/look-up-all-descendants-of-a-class-in-ruby
Jeffrey 'jf' Lim
@jf
thank you, Sebastian! that helps!
postmodern
@postmodern:matrix.org
[m]
Hi, I'm looking for an example app that uses both hanami-model (for app models) and another database via ActiveRecord.
postmodern
@postmodern:matrix.org
[m]
:point_up: Edit: Hi, I'm looking for an example app that uses both hanami-model (for app models) and another database via ActiveRecord. The other database would be managed by AR models from another gem. I'm guessing I'd need to load the gem's AR migrations in db/migrate and initialize ActiveRecord somewhere in config/...?
postmodern
@postmodern:matrix.org
[m]
Hmm it may reduce future contributor confusion if I just used AR for both databases.
Seb Wilgosz
@swilgosz
@postmodern:matrix.org First of all, keep in mind, that it's unclear if Hanami-Model will be used in Hanami 2.0. There is a big chance, that ROM 6.0 will be used directly. Therefore, please share the more insights why do you think that AR is needed to connect to a database? In ROM you can create migrations based on the current database schema, no need to import AR migrations and work with it. Then, you can create your ROM entities to infer from the database structure, just table names need to match. You could use ROM entities to just connect to multiple databases.
postmodern
@postmodern:matrix.org
[m]
well I want to have a library of DB models+migrations separate from the web app. Previously I used DataMapper for this library but that is defunct now. ROM seems a bit heavy, esp for CRUD and crafting SQL queries. AR has more users (due to Rails) and is more accessible for other developers who might contribute to the library or the web app. If I used the library in the app, than the library migrations would also need to be called along with the app's migrations. Also, the app would need to define it's own models for User, etc, separate from the library. So if I wanted to make it easy for contributors to contribute to both the db library and the app, than it seems consistent to use AR in both.
postmodern
@postmodern:matrix.org
[m]
:point_up: Edit: well I want to have a db library of DB models+migrations separate from the web app. Previously I used DataMapper for this library but that is defunct now. ROM seems a bit heavy, esp for CRUD and crafting SQL queries. AR has more users (due to Rails) and is more accessible for other developers who might contribute to the library or the web app. If I used the library in the app, than the library migrations would also need to be called along with the app's migrations. Also, the app would need to define it's own models for User, etc, separate from the library. So if I wanted to make it easy for contributors to contribute to both the db library and the app, than it seems consistent to use AR in both.
Seb Wilgosz
@swilgosz
Fair points. I do believe that the pool of ROM users will increase a lot after Hanami 2 is released, however I understand your motives. Thanks for the explanation and I am sorry for not being too helpful here.
@postmodern:matrix.org you can also try to ask on https://discourse.hanamirb.org/, the core team members are a bit more active there and the whole Hanami communication strategy is moving the attention more to forums (discourse, StackOverflow) than chats.
postmodern
@postmodern:matrix.org
[m]
oh cool, thanks!
ume-san
@ume-san:matrix.org
[m]
I have started using Hanami 1.3, and it's really great! I am also interested in 2.0. As far as I see an example of 2.0, https://github.com/hanami/hanami-2-application-template , there's no 'apps' directory. 'Slices' directory seems to be an alternative in 2.0. It would be great if there's an explanation about the difference between apps in 1.3 and slices in 2.0. Could someone explain it ?
Seb Wilgosz
@swilgosz
Yes, the slices is a replacement for apps. I do that have comparison of 2.0 vs 1.3 just yet. I an working on official guides for 2.0, and one of the chapters will be about upgrade notes, but this will he done as a very last part. I did publish the comparison of Rails and Hanami 2 architecture recently with YT video guide included. Feel free to check it out! https://hanamimastery.com/episodes/8-rails-vs-hanami-mapping-frameworks
Also feel free to subscribe to my Hanami Mastery channel and newsletter to get more learning resources about Hanami 2 and cirresponding gem families:)
Oh, sorry for the typo, I meant: I don't have comparison of Hanami 2 and 1.3, and I don't think there is anything official atm.
ume-san
@ume-san:matrix.org
[m]
@swilgosz: Thank you for your resources! Hanami Mastery is really helpful. I understand Hanami intends various abstractions, and it can be better than Rails.
I feel 2.0 intends more abstractions than 1.3, and I do not understand it and am still confused about it.
For example, 'show' action and 'show' view exist in very deep places, /slices/{main/lib/}main/actions/home/show.rb and /slices/{main/lib/}main/views/home/show.rb (curly braces are used just to emphasize). I do not understand the abstraction of {main/lib} part. From the view of 1.3, /slices/main/actions/home/show.rb and /slices/main/views/home/show.rb may be enough??
I hope there will be some explanations about these newly introduced abstractions or concepts in 2.0 !
Seb Wilgosz
@swilgosz
@ume-san:matrix.org this unnecessary redundant namespacing is exactly what Tim Riley worked on last month! The recent dry-system release solves exactly this problem and the next Hanami 2 alpha release will have simplified file structure:)
See the dry-system changes here: github.com/dry-rb/dry-system/blob/52e197b0aa8bd0301befc5afeb55e19a4ff6e8d6/spec/integration/container/auto_registration/component_dir_namespaces/multiple_namespaces_spec.rb
Seb Wilgosz
@swilgosz
And you may expect more details in the next Open Source update article:)
Edit: And you may expect more details in the next Tim's Open Source update article:)
ume-san
@ume-san:matrix.org
[m]
It sounds really great ! Simplified structure must be beneficial when migrating from 1.3 to 2.0 !! Thank you for you guys efforts !!
Seb Wilgosz
@swilgosz
BTW, Again, I strongly suggest to move to discourse.hanamirb.org as it's way easier to to track multiple threads and we would be able easier for us to help more people simultanously :). You may expect official announcement soon, similar as for rom-rb gitter chat.
ume-san
@ume-san:matrix.org
[m]
Pinned post on question category of discourse.hanamirb.org lead me here...
1 reply
Next time, I will post there!
postmodern
@postmodern:matrix.org
[m]
have you thought about setting up an unofficial Discord server? It's actually much nicer than Slack, and supports creating Threads that auto-expire.
Seb Wilgosz
@swilgosz
@ume-san:matrix.org :xD ! That's fine:) . I don't mind chatting a bit ;)
@postmodern:matrix.org I am unaware of the community preferences, feel free to open a forum thread and collect feedback!:). I personally love discord, but I use pretty much everything so I'm not the best person to vote.
ume-san
@ume-san:matrix.org
[m]
👍️
Andreas Haller
@ahx
Hi. I have a question about hanami-router / hanami-api.
It is not possible to use scope with a path variable like scope ':tenant_id', am I right?
Would that be even possible with the trie based router?
4 replies
Seb Wilgosz
@swilgosz
Hi all, if anyone is struggling with persistence layer in Hanami 2.0, I've just published the complete guide for this topic as a new Hanami Mastery episode. Feel free to check it out! https://hanamimastery.com/episodes/9-guide-to-models-in-hanami-and-rom
Jeffrey 'jf' Lim
@jf

is anybody aware of an issue with the "Getting Started" guide? I'm working through it and am just before "Displaying Validation Errors", and then I hit this issue with Hanami booting:

An error occurred while loading spec_helper.
Failure/Error: Hanami.boot

NoMethodError:
  undefined method `size' for nil:NilClass
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/dry-validation-0.11.0/lib/dry/validation/schema/deprecated.rb:11:in `input_processor'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/dry-validation-0.11.0/lib/dry/validation/schema/class_interface.rb:165:in `default_options'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/dry-validation-0.11.0/lib/dry/validation/schema/class_interface.rb:35:in `new'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/hanami-validations-1.3.7/lib/hanami/validations.rb:109:in `validations'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/hanami-controller-1.3.3/lib/hanami/action/params.rb:152:in `params'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/hanami-controller-1.3.3/lib/hanami/action/validatable.rb:100:in `block in params'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/hanami-controller-1.3.3/lib/hanami/action/validatable.rb:100:in `class_eval'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/hanami-controller-1.3.3/lib/hanami/action/validatable.rb:100:in `params'
# ./apps/web/controllers/books/create.rb:9:in `<class:Create>'
# ./apps/web/controllers/books/create.rb:4:in `<module:Books>'
# ./apps/web/controllers/books/create.rb:3:in `<module:Controllers>'
# ./apps/web/controllers/books/create.rb:2:in `<module:Web>'
# ./apps/web/controllers/books/create.rb:1:in `<top (required)>'
# /home/x/.rbenv/versions/2.7.4/gemsets/hnm/gems/hanami-utils-1.3.8/lib/hanami/utils.rb:56:in `require_relative'
...

This is most unexpected. I've dug through some of the gems... and arrived at dry-validation-0.11.0/lib/dry/validation/schema/deprecated.rb, where this is the offending line (apparently type_map is not expected to be nil):
elsif type_map.size > 0 && config.input_processor != :noop

I don't know where type_map is set though

2 replies
Seb Wilgosz
@swilgosz
I personally am only helping with 2.0 and I strongly suggest to start from there. I have already published video resources helping to create a blog application on http://hanamimastery.com . I do work on guides for hanami 2.0 and I do support my GH sponsors directly aside of helping in these official channels. I think if you will start from the development version, hanami template repo, you will have ton of time saved in the longer run :)
1 reply
For 1.3 I will only be concerned to help people update to 2.0
Seb Wilgosz
@swilgosz
I do understand your frustration. I don't tell you to drop it, It's just my friendly advice that I believe will save you a lot of time, because hanami 2.0 is a rewriting of the framework, and a lot of concepts just changed completely. You could be more frustrated to spend months on Hanami 1.3 just to realize that for 2.0 you need to learn a big part of the framework again. Hanami 2 is already in alpha, next alpha version will be released soon, and I don't see much sense to learn deeply version that will be outdated soon. I am publishing content about Hanami 2 to manage limited time resources I have, want to recird videos that will last for a while. And about episodes themselves: you don't need to go through all, I have a hanami tag, where you can just filter by hanami tutorials. I also have a complete source code for each episode, https://github.com/swilgosz/hanamimastery . Those are showcases though, I am doing my best, but its not complete and not all cases are covered yet. The Hanami guides (official) I am also doing in my free time, while learning the framework in parallel! As this is an in-development version, there are parts I need to figure out on my own or find workarounds until proper feature is implemented. While I am in the close contact with the core team, they are really busy with developing the 2.0 releases, so it's easier to get support with that one, even though you may encounter more problems.
Hanami Mastery is not named because I am the master, but rather to reflect my journey to become master in the future, while helping others do the same but easier :)
Seb Wilgosz
@swilgosz
I honestly think that HanamiMastery is currently the best starting point in the world to play with Hanami 2, until the 2.0 guides are in place. Then HM will become just an addition. Keep in mind, I am doing all this work voluntarily as a standalone person, not being in the core Hanami team because I want to speed up the process of releasing Hanami 2 and the adoption by the ruby community. Because of that I am sorry if I make mistakes or will cause you troubles. I always try to helo as much as I can though.
Update: I always try to help*....
Seb Wilgosz
@swilgosz
And sorry for lonking wrong repo above. Here is correct one: https://github.com/hanamimastery/episodes
Jeffrey 'jf' Lim
@jf
ok. I understand and appreciate the explanation. I have no idea what's coming down the pipeline besides the official website. That's what I've been using so far. If a 2.0 is coming and it's better to simply wait, or go elsewhere for other resources, I think it would be good to mention it on the official websites, whether that be at the main page of hanamirb.org, in the guide/s, and/or github.
Seb Wilgosz
@swilgosz
That's a very good point actually! Will try to do sth about it!