Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 19 17:46
    acasaism starred hanami/validations
  • May 19 11:48

    timriley on v2.0.0.alpha8

    (compare)

  • May 19 11:43

    timriley on main

    Prepare for v2.0.0.alpha8 (compare)

  • May 19 11:32

    timriley on v2.0.0.alpha8

    (compare)

  • May 19 11:30

    timriley on main

    Prepare for v2.0.0.alpha8 (compare)

  • May 19 11:29

    timriley on v2.0.0.alpha8

    (compare)

  • May 19 11:29

    timriley on main

    Prepare for v2.0.0.alpha8 (compare)

  • May 18 20:58
    tak1n edited #380
  • May 18 20:57
    tak1n opened #380
  • May 18 18:15
    tak1n commented #257
  • May 18 16:48
    tak1n synchronize #379
  • May 18 14:02

    timriley on main

    Add CHANGELOG entry for v2.0.0.… (compare)

  • May 18 13:19

    timriley on main

    Add CHANGELOG entry for v2.0.0.… (compare)

  • May 18 13:18

    timriley on main

    Prepare CHANGELOG entry for v2.… (compare)

  • May 18 13:18

    timriley on main

    Prepare CHANGELOG entry for v2.… (compare)

  • May 18 08:55
    tak1n synchronize #379
  • May 18 00:04
    tak1n opened #379
  • May 17 21:29
    tak1n commented #279
  • May 17 21:01
    KARTHEEK264 starred hanami/hanami
  • May 17 20:18
    tak1n closed #378
Sebastjan Hribar
@sebastjan-hribar
RE my question above: apps\web\views\application_layout.rb has access to session and other apps like apps\myApp\views\application_layout.rb don't. Why is that?
Sebastjan Hribar
@sebastjan-hribar
I've fixed it my making a helper module accessible to all top views.
Sebastjan Hribar
@sebastjan-hribar
I've just released Rokku 0.7.0. We found a bug when using policies for controllers with the same name. This is now fixed. I've also prepared a short blog post on the use with Hanami 1.3.
Daniel Mircea
@viseztrance
Hi. Could anyone give me a rough estimate of when we'll see version 2 beta / rc released? I'm sure this gets asked a lot but I didn't find any timetable aside from a trello board.
2 replies
Aestimo
@iamaestimo
Is anyone having an issue running bundle when working with the hanami 2 template...for some reason, mine is stuck and does not process beyond this point (ongoing now for over half an hour)
...
Running bundle install - this may take a few minutes
Fetching gem metadata from https://rubygems.org/.........
Fetching https://github.com/hanami/hanami.git
`
Aestimo
@iamaestimo

Hey Hanami experts, I've just cloned the template repo for Hanami 2, followed the steps for setting up, but when it came time to setup a new migration, I ran into the following error:

`method_missing': undefined method `session_secret' for #<Hanami::Application::Settings:0x000055af322964b8 @config=#<Dry::Configurable::Config values={}>> (NoMethodError)

What could I be doing wrong?

Hey Hanami experts, I've just cloned the template repo for Hanami 2, followed the steps for setting up, but when it came time to setup a new migration, I ran into the following error:

`method_missing': undefined method `session_secret' for #<Hanami::Application::Settings:0x000055af322964b8 @config=#<Dry::Configurable::Config values={}>> (NoMethodError)

What could I be doing wrong?

By the way, I've already setup a secret string in the .env file

5 replies
divjot124
@divjot124
hi,can anyone tell me detail reason why hanami has simple code and uses less memory.need it for proof of concept
2 replies
divjot124
@divjot124
hi,could you all tell me some great features that hanami is missing in comparison to rails.
2 replies
Sebastjan Hribar
@sebastjan-hribar
Hi all, I've just posted a question about deployment and hosting services. I'd really appreciate any advise on the topic.
Sebastjan Hribar
@sebastjan-hribar
Hi, I've enabled logging in production and when I pass the stream option I get this error: /usr/local/bundle/gems/http_router-0.11.2/lib/http_router/request.rb:10: warning: URI.unescape is obsolete.
4 replies
It was already reported by @jodosha: joshbuddy/http_router#44. Can I still use this feature, asking more from a performance point of view. The logs get written ok.
Sebastjan Hribar
@sebastjan-hribar

Hi, I've encountered another issue when deploying to production. I'm deploying with docker on client's server and I have bundle exec hanami assets precompile in my docker compose right before starting the server. However, not all assets are in the publicfolder.

If I run precompile before the build and don't run precompile with compose then I get the Internal Server Error.
If I run precompile in a running container the assets are again not served.

I have the option to serve static assets set to true in my .env.production.
As per usual, what am I doing wrong?

5 replies
Sebastjan Hribar
@sebastjan-hribar
I have another matter to tackle, how do I go about running a raw sql query in my rake task? I need to create a pg extension. I can't do it in my compose file because the DB doesn't exist at that point. So my next thought was a separate rake task.
Sebastjan Hribar
@sebastjan-hribar
I ended up doing this in a migration:
Hanami::Model.migration do
  change do
    execute 'CREATE EXTENSION IF NOT EXISTS "pg_trgm"'
  end
end
Jin Feng Xie
@FLemon
Hi, am wondering any one has experience in migrating project from using hanami::model to ROM(standalone) ?
36 replies
ume-san
@ume-san:matrix.org
[m]
Do you think for which of the following use case Hanami 2.0 alpha 6 can be used?
I am really expecting a lot from Hanami 2.0 and I am willing to use it right now. Do you think I can use it for 4 now?
  1. For a personal use (where service can be stopped for a week)
  2. For a community with known people (where service can be stopped for one day)
  3. For a within-company communication tool (where service can be stopped after work)
  4. For a large community with unknown people (where service can be stopped for a few hours)
  5. For a service to customers (where service should not be stopped)
1 reply
ume-san
@ume-san:matrix.org
[m]
My concern is whether Hanami 2.0 updates are what Hanami 2.0 users can follow. Is there any way for Hanami users to follow API changes and directory structure changes? But some people are already using V2 for production apps, which means my concerns are just concerns.
Sebastjan Hribar
@sebastjan-hribar

Is it possible to have raw sql like this:

  def find_by_segment_match(source_text_for_lookup, source_lang)
    segments
      .read("set pg_trgm.similarity_threshold TO 0.4;
      SELECT *, SIMILARITY(segments.content, '#{source_text_for_lookup}') AS similarity
      FROM segments
      JOIN translation_records
      ON segments.id = translation_records.source_segment_id
      LEFT JOIN segments AS target_segments
      ON translation_records.target_segment_id = target_segments.id
      WHERE segments.language_id = #{source_lang} AND segments.content % '#{source_text_for_lookup}'
      ORDER BY segments.content <-> '#{source_text_for_lookup}';").map_to(Segment)
  end

and to map it to a entity, in my case Segment. I wanted to use raw sql since I have trouble implementing the LEFT JOIN with Hanami.

lovelymono
@lovelymono:matrix.org
[m]
Uhm, hi!
How do you go about installing Hanami 2 using gem?
Brandon Weaver
@baweaver

Ohai. One thing that I was always tempted to try for Rails was making a lighter-weight RuboCop AST code migration tool to automate most of the upgrades for folks.

Would that be of much interest here?

1 reply
Brandon Weaver
@baweaver:matrix.org
[m]
Ok, trying out Matrix instead of a web tab which I'll lose track of.
Brandon Weaver
@baweaver:matrix.org
[m]
(Speaking of, up for any advice on managing n+1 chat apps between Discord, Slack, Matrix, etc etc)
KOW
@kowfm_twitter
Hey friends. Is Hanami suitable for apis? I was pointed to use https://github.com/hanami/api on Twitter but I'm not sure if this is an addon to hanami or a replacement.
9 replies
KOW
@kowfm_twitter
I have a question. How do you reset the database in the test environment? I've run into a situation where subsequent tests written while following the tutorials fail because of a Unique constraint on a table.
1 reply
Sebastjan Hribar
@sebastjan-hribar
Regarding my above question of mapping to another entity, I've posted a bit more detailed use case and problem description here: https://discourse.hanamirb.org/t/complex-joins-and-raw-sql-query-problem/687/2. Could someone check and confirm that I'm doing something wrong or is this an issue to report? In short, I need to map a query result to another entity or a Dry::Struct.
Sebastjan Hribar
@sebastjan-hribar
Just found this workaround: I setup a placeholder entity with a repo and read the raw sql there. It's a prototype so I'll post my answer when I have it fully working.
Paul Sadauskas
@paul
Where does Rack middleware get added in Hanami 2? (specifically omniauth)
1 reply
Joel AZEMAR
@joel
Hi folks! Is there a simple way to get the Guide 2.0 other than through the pending PRs https://github.com/hanami/guides/pulls? Thanks 🙏
Sebastjan Hribar
@sebastjan-hribar

Hi , I've ran this migration, which completed without errors, but when I run the server below:

Hanami::Model.migration do
  change do
    alter_table :segments do
    add_column :ts_content1, :tsvector, generated_always_as: [to_tsvector: [:simple, :content]]
    end
  end
end

Error:

Hanami::Model::Error: missing attributes in ROM::Relation::Name(segments) schema: :ts_content1

How can I debug this?

Sebastjan Hribar
@sebastjan-hribar
Basically, I can't use inferred schema and I can't use custom schema, since tsvector is not supported data type. Any way around this?
It's frustrating since we're loosing on performance.
Tim Chou
@timzzzhou_gitlab
Hi, I have a question about puma server. How to configure Puma for a Hanami Application? I use docker container for ruby services and run these services on AWS ECS for production.
1 reply
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?
9 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!
2 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 :)