Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 07:16
    depfu[bot] labeled #623
  • 07:16
    depfu[bot] opened #623
  • 07:16

    depfu[bot] on update

    Update rom-sql to version 3.3.3 (compare)

  • Mar 05 16:44
    wenderjean commented #595
  • Mar 05 14:26
    zelaznogydna91 starred hanami/hanami
  • Mar 05 14:14
    jodosha closed #213
  • Mar 05 14:14
    jodosha commented #213
  • Mar 05 14:14
    jodosha labeled #213
  • Mar 05 14:14
    jodosha assigned #213
  • Mar 05 13:41
    artjomjuferov edited #213
  • Mar 05 13:41
    artjomjuferov opened #213
  • Mar 05 02:04
    adam12 commented #595
  • Mar 05 02:03
    adam12 labeled #622
  • Mar 05 01:58
    adam12 opened #622
  • Mar 05 01:58
    adam12 assigned #622
  • Mar 05 01:49

    adam12 on pg-env-variables

    Password in connection string (compare)

  • Mar 05 01:47

    adam12 on pg-env-variables

    Pass env to system in postgresq… Remove manual PGPASSWORD settin… Call postgresql command with en… and 2 more (compare)

  • Mar 05 01:37

    adam12 on pg-env-variables

    Re-enable ci test (compare)

  • Mar 05 01:32

    adam12 on pg-env-variables

    Password in connection string Re-enable ci test (compare)

  • Mar 05 00:43

    adam12 on pg-env-variables

    Tmate single pg test (compare)

Máximo Mussini
@ElMassimo
For an example on how to migrate from Webpack, ElMassimo/pingcrm-vite#1.
adam12
@adam12_:matrix.org
[m]
Cool thanks!
Máximo Mussini
@ElMassimo
:+1:
Vasili Cekaskin
@VasiliCekaskin
Hi guys, I've got a question regarding path variables. Is there a restriction on the format? I cannot get it working with camel cased path variables.
Vítor Avelino
@vitoravelino
nice job, @ElMassimo!
Árni Gunnarsson
@arni1981_gitlab
I set up a simple ruby project using code from this nice tutorial https://ryanbigg.com/2020/02/rom-and-dry-showcase-part-1 This uses the hanami-controller and hanami-router. I'm trying to wire up controllers to use hanami-view but with no luck yet. There isn't much (or anything at all) in the docs about wiring the controller and view together when used as standalone gems. I get the view to render by calling it directly from the controller with self.body = Views::Users::Index.render ... but that is not what I'm after.
adam12
@adam12_:matrix.org
[m]
@arni1981_gitlab: What are you after? And what version of hanami-view?
Árni Gunnarsson
@arni1981_gitlab
That the controller and the view work together as in hanami, version 1.3.2
bradherman
@bradherman_twitter
Hey everyone! Want to spin up a lightweight API w/ Postgres + Hanami... I saw there's a hanami-api gem now, but that doesn't have any generators or anything... Is the best way to start this up to work from scratch? Or should I be generating a regular Hanami project and mounting an API with hanami-api inside?
adam12
@adam12_:matrix.org
[m]
@bradherman_twitter: No great answer unfortunately.

Hanami 2 work is ongoing, but nothing really suitable for anybody but early adopters. You'll be prone to some change that might be unavoidable.

Hanami 1 works but the model layer is changing in Hanami 2, so we're not sure how backwards compatibility might look. Folder structure is changing likely as well.

bradherman
@bradherman_twitter
Ahh gotcha
I'm not against changes, as this is simply going to be a small api essentially hosting a database of vehicle information with a few filters
adam12
@adam12_:matrix.org
[m]
@bradherman_twitter: If you're willing to experiment, there is a "application template" from Tim that is probably suitable. https://github.com/timriley/hanami-2-application-template
bradherman
@bradherman_twitter
awesome... thanks!
adam12
@adam12_:matrix.org
[m]
I'm not sure I'd bother with hanami-api on it's own. It's built on top of other components that Hanami 2 are already using (hanami-controller and hanami-router). The small DSL you get would likely be better with the full template style. Your decision obviously.
If you were doing an integration with an existing project, or wanting something different (ActiveRecord, Sequel, etc) then hanami-api would probably be a good fit.
bradherman
@bradherman_twitter
thanks for the info
Armin
@wuarmin
@bradherman_twitter I'm using hanami-api with Sequel and Ruby GraphQL. It was a good choice. I think it's better than using an inflated web-framework for an api use case.
Armin
@wuarmin
I'm also using hanami 1.3. It works great, but my problem is, that there I have to use outdated gem versions (rom, sequel, factory bot), I cannot update.
Norbert Zsolt Bakó
@norbertbakoascenda

Hi guys, I have a question about the parameter validations in the controllers. We want to validate some Array type parameters, but the error message we get is not the desired one. We invoke the validation in the param block with: required(:channels).filled { each { included_in?(Offer::CHANNELS) } }

The problem comes from the params.error_messages method. It maps the error messages in a way, that in the end, the output comes without the name of the field, and only the index where the validation error occured: "message": "0 must be one of: online, offline, phone" and it does not state that this error belongs to the channel field. My desired output would be something that includes the field name also, not just the index.

So my question is, that is this the intended way for this method to work? We did a workaround with a custom predicate and error message, but I am curious, how would you solve this? What would be the hanami way of doing this?

Thanks in advance!

adam12
@adam12_:matrix.org
[m]
@norbertbakoascenda: Which version of hanami-validations are you using?
Norbert Zsolt Bakó
@norbertbakoascenda
@adam12 hanami-validations (1.3.6)
adam12
@adam12_:matrix.org
[m]
@norbertbakoascenda: That might be the best you can get for now with the 1.x series. It's version locked to a very old version of dry-validation and dry-schema.
Norbert Zsolt Bakó
@norbertbakoascenda
Thought so, thanks!
Masanori Ohnishi
@MasanoriOnishi
I have a question.
Hanami uses Hanami::CommonLogger to output access logs (like typical rack logs).
When I want to add more attribute(ex. user_id in request.env) to that log, how can I do.
Shoud I extend Hanami::CommonLogger implementation??
adam12
@adam12_:matrix.org
[m]
@MasanoriOnishi: I'd extend Hanami::CommonLogger.
Masanori Ohnishi
@MasanoriOnishi
@adam12_:matrix.org
Thank you for your fast reply.
I'll solve the problem by using what you said.
However I want hanami to treat the customization of Hanami::CommonLogger :cry:
Marwan Rabbâa
@waghanza
@jodosha which rack implementation is supported ?
at least from what I know, puma is supported, but could I use any async server like https://github.com/socketry/falcon
adam12
@adam12_:matrix.org
[m]
Rack is rack. Other than versions, the Rack interface is static.
I don't see what the failure is. Where can I find the specs that's failing in your issue?
adam12
@adam12_:matrix.org
[m]
I'll respond in issue.
Sebastjan Hribar
@sebastjan-hribar

Hi, can someone help me understand the following conundrum:
I've changed this

  def find_by_segment_match(source_text_for_lookup, source_lang, sim_score)
    aggregate(:translation_records)
      .where(language_id: source_lang)
      .where { similarity(:content, source_text_for_lookup) > sim_score/100.00 }
      .select_append { float::similarity(:content, source_text_for_lookup).as(:similarity) }
      .order { similarity(:content, source_text_for_lookup).desc }
  end

to this

  def find_by_segment_match1(source_text_for_lookup, source_lang, sim_score)
    segments
      .where(language_id: source_lang)
      .where { similarity(:content, source_text_for_lookup) > sim_score/100.00 }
      .select_append { float::similarity(:content, source_text_for_lookup).as(:similarity) }
      .order { similarity(:content, source_text_for_lookup).desc }
  end

And now I don't get back the similarity function result.

This is in the segment repository where I've removed translation_record aggregation since it didn't work well on the current model version.

Instead, I'm just selecting segments and the select_append is not returned.
Sebastjan Hribar
@sebastjan-hribar
I should note that similarity is calculated for the content, which is segment's attribute. It isn't affected by translation_records.
Aleksander Smywiński-Pohl
@apohllo
Have you tried looking into SQL log?
btw you say you don't get the result
is there an error or the column is missing?
Sebastjan Hribar
@sebastjan-hribar
@apohllo Here is a gist of server log. Note that similarity is appended in line 21 and 33, whereas it is not in the query result for no aggregation.
@apohllo Off-topic: great avatar :)
Armin
@wuarmin
Good morning! Where is the right place to open a Sequel-DB-Connection and store it in a constant in hanami 1.3? In config/environment.rb? The puma webserver uses 5 workers and preloads the app.
Armin
@wuarmin
I have the sequel connect in config/environment.rb but get Sequel::DatabaseDisconnectError: PG::UnableToSend: SSL SYSCALL error: EOF detected-errors after some time, even though I call disconnect of the db in puma's on_worker_boot-hook.
Armin
@wuarmin
Do I have to call disconnect in before_fork?
Árni Gunnarsson
@arni1981_gitlab
Armin
@wuarmin
@arni1981_gitlab great! Thank you. There are so much different assumptions on the web regarding this topic.
Armin
@wuarmin
@arni1981_gitlab I still get the error: Sequel::DatabaseDisconnectError: PG::UnableToSend: SSL SYSCALL error: EOF detected after some time.
Armin
@wuarmin
# config/environment.rb
# ...
DWH = Sequel.connect(ENV['DWH'], :loggers => [Logger.new($stdout)])
#...
# config/puma.rb
require_relative './environment'
workers 5

threads_count = 1
threads threads_count, threads_count

daemonize true
stdout_redirect '/home/user/app/shared/log/puma.stdout.log', '/home/user/app/shared/log/puma.stderr.log', true
pidfile "/home/user/app/shared/pids/puma.pid"

preload_app!

rackup      DefaultRackup
port        2300
environment 'production'

before_fork do
  DWH.disconnect
end

on_worker_boot do
  Hanami.boot
end
Armin
@wuarmin
For the sake of completeness: here's my conclusion about my DatabaseDisconnectError-issue https://stackoverflow.com/questions/66443278/ocurrence-of-sequeldatabasedisconnecterror-at-puma-worker-even-though-the-db/66452766#66452766
Somebody still possibly has a solution trial...
Sebastjan Hribar
@sebastjan-hribar
RE select_append from a few posts up. I couldn't get it to work, i.e. to append to the Segment record. My best guess is the limitation of mapping to the entity. So for now I have a rather ugly workaround where I still do aggregate but overwrite the translation_recordsarray later on. I'll wait for higher versions of Hanami model to refactor this.
Edouard
@inouire_twitter
Thanks @wuarmin I've got some similar problems recently, I will have a look at that