depfu[bot] on update
depfu[bot] on update
Update bigdecimal to version 3.… (compare)
jodosha on main
Allow for nil @logdev (#395) I… (compare)
Hi all, I'd like to ask for you input on this use case: I'd like to move some rake tasks to UI actions. These tasks import CSV data, parse them and create DB records. Currently admin needs to run these inside the container. Since these need to be run more than once I need to make things simpler. The CSV files do not need to be stored on the server. So I'm thinking to have a file selection UI element that reads the file into memory and does the same processing as the rake tasks.
So I would use JS to read in the file and pass it in memory as a param to an interactor on a designated action. Is this the way to go? And should I take any special security measures?
Edit: @sebastjan-hribar what about the size of the file? Won't it be a memory issue if you'd work with big files? I see it as a bit risky if you need to load all the content without checking the max file size first. I would still save the file on the server, even in the temporary storage, and clean it up after processing finishes. This way I would introduce two endpoints, for file upload creation, and the second one for processing it. You could still merge those endpoints if that's a requirement.
PS: Sorry for typos in my original message, I really need to stop answering from mobile :)
Hello! :) i have few questions following custom helpers
i notices changing order of
load_paths impacts code loading, if i add 'helpers' dir last:
load_paths << [ 'controllers', 'views', 'helpers' ]
then my Helper's don't get loaded, i get
uninitialized constant Web::Helpers during
How do you gyus test helpers? Some helpers i have are dependent on
Now I created a
DummyView and test this helper the same way as view, but maybe it would be possible to test this helper in isolation? some ideas? :)
question: i want to add 'log out' link. I have DELETE route for destroying user's session. I want to add it on template, in navbar, but it has to be form (as i need to make DELETE request). But then unit test for Layout fails, because of form helper:
NoMethodError: undefined method `params' for #<Web::Views::ApplicationLayout:0x000055b1bfa7b1a8>
Some ideas? I could change route for GET and use normal link. Or try to disable CSRF protection somehow maybe? Or fix my test somehow :)
Folks, as you may have read in the alpha3 announcement, we’re going to release :point_right: monthly alphas :point_left:.
So far the alpha releases were scope bound :chart_with_upwards_trend:.
When the scope was developed, we used to release it.
Now that the ground work is done (thanks Tim :pray: ), we can change the release strategy and make it time bound :stopwatch:.
Once a month, we :shipit: a new alpha, with the improvements that we made since the previous release.
This puts us in a position to release often and build momentum. :fire:
We will focus on the cleanup of the application template. https://github.com/hanami/hanami-2-application-template
The template is a working Hanami 2 app.
By cleaning up it, we can reverse engineer what we need to implement in the framework.
:call_me_hand: If you want to contribute to Hanami, please start from the application template needs, and the work backward to enhance Hanami.
This is my first part of my yesterday's question. I've removed the gem list:
I'm experiencing a really odd issue. I'm getting
TypeError at no implicit conversion of Integer into String for this line:
session[:session_start_time] + @validity_time.to_i < Time.now. This started on a development branch where the only change that might impact this is the
gemfile.lock. On master,
session[:session_start_time] is a
NilClass and on the development the
session[:session_start_time] is a String class. I did delete the
gemfile.lock on the development and ran a fresh bundle install. The
session[:session_start_time] is set as
I've checked Tachiban and irb for the comparison and it runs fine, as well as on the master branch.
Now for the solution:
I've found the culprit. It was
hanami 1.5.0. Reverting it back to
hanami 1.3.0 solves the problem. Now I don't know, does this qualify for an issue for Hanami or Tachiban?
scopewith path parameters feels a bit lonely. hanami/api#29
Hey, sorry if it's been asked before. 1 day into Hanami
Is there a good hanami 2 app example with project structure?
Found https://github.com/hanami/hanami-2-application-template but it seems it doesn't have all the entities
Yo guys, quick question. Does hanami2(rom, sequeel) support psql yet?
When I run:
bundle exec hanami db create_migration apples
/src/vendor/bundle/ruby/3.0.0/gems/hanami-cli-2.0.0.alpha3/lib/hanami/cli/commands/db/utils/database.rb:32:in `block in ': psql is not a supported db scheme (RuntimeError)
docker-compose run --rm apple_project bundle exec hanami db drop Creating apple_project_apple_project_run ... done => database apple_project_development dropped ❯ ❯ brun hanami db create docker-compose run --rm apple_project bundle exec hanami db create Creating apple_project_apple_project_run ... done => database apple_project_development created ❯ brun hanami db migrate docker-compose run --rm apple_project bundle exec hanami db migrate Creating apple_project_apple_project_run ... done bundler: failed to load command: hanami (/brokerkit/src/vendor/bundle/ruby/3.0.0/bin/hanami) /brokerkit/src/vendor/bundle/ruby/3.0.0/gems/sequel-5.50.0/lib/sequel/adapters/postgres.rb:210:in `initialize': PG::ConnectionBad: FATAL: database "apple_project_development" does not exist (Sequel::DatabaseConnectionError)
hanamin db create_migration create_usersI keep getting the error below...what am I missing?
Traceback (most recent call last): 23: from /home/aes/.rbenv/versions/2.7.2/bin/hanami:23:in `<main>' 22: from /home/aes/.rbenv/versions/2.7.2/bin/hanami:23:in `load' 21: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hanami-cli-2.0.0.alpha3/exe/hanami:10:in `<top (required)>' 20: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-cli-0.7.0/lib/dry/cli.rb:65:in `call' 19: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-cli-0.7.0/lib/dry/cli.rb:116:in `perform_registry' 18: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hanami-cli-2.0.0.alpha3/lib/hanami/cli/commands/application.rb:15:in `call' 17: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hanami-cli-2.0.0.alpha3/lib/hanami/cli/commands/monolith/db/create_migration.rb:17:in `call' 16: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hanami-cli-2.0.0.alpha3/lib/hanami/cli/commands/application.rb:54:in `database' 15: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hanami-cli-2.0.0.alpha3/lib/hanami/cli/commands/application.rb:28:in `application' 14: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hanami-cli-2.0.0.alpha3/lib/hanami/cli/commands/application.rb:28:in `require' 13: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/hanami-5998b4f58d84/lib/hanami/init.rb:3:in `<top (required)>' 12: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/hanami-5998b4f58d84/lib/hanami/init.rb:3:in `require_relative' 11: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/hanami-5998b4f58d84/lib/hanami/setup.rb:7:in `<top (required)>' 10: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/zeitwerk-2.5.1/lib/zeitwerk/kernel.rb:35:in `require' 9: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/zeitwerk-2.5.1/lib/zeitwerk/kernel.rb:35:in `require' 8: from /home/aes/Coding/Ruby/HANAMI/hanami_2_auth_app/config/application.rb:11:in `<top (required)>' 7: from /home/aes/Coding/Ruby/HANAMI/hanami_2_auth_app/config/application.rb:12:in `<module:Hanami2AuthApp>' 6: from /home/aes/Coding/Ruby/HANAMI/hanami_2_auth_app/config/application.rb:15:in `<class:Application>' 5: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/hanami-5998b4f58d84/lib/hanami/application/settings.rb:82:in `method_missing' 4: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-configurable-0.13.0/lib/dry/configurable/config.rb:112:in `method_missing' 3: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-configurable-0.13.0/lib/dry/configurable/setting.rb:79:in `value' 2: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-configurable-0.13.0/lib/dry/configurable/setting.rb:147:in `evaluate' 1: from /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-types-1.5.1/lib/dry/types/type.rb:49:in `call' /home/aes/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dry-types-1.5.1/lib/dry/types/constrained.rb:42:in `call_unsafe': nil violates constraints (type?(String, nil) failed) (Dry::Types::ConstraintError)
container['interactors.interactor_name']? What if I typo the container name, when will Hanami catch that?
Hi everyone, I've written a JWT authorization gem build on top of dry to easily integrate with Hanami 2.0. https://discourse.hanamirb.org/t/authentication-and-authorization-recommendations/200/6?u=swilgosz
Feel free to check it out! A cool thing is that it uses dry-effects! :D
video.find(id)I get both
.location_idto be nil and I can't do a consecutive
location.findbecause of that. How do I do this?
aggregate(:location).where(id: id).map_to(Video).onein a single call — one of them doesn't seem to update parent object. or am I doing something wrong with this?
class VideoRepository < Hanami::Repository associations do belongs_to :location has_one :video_info end def find_with_location(id) aggregate(:location).where(id: id).map_to(Video).one end def find_with_info(id) aggregate(:video_info).where(id: id).map_to(Video).one end def find_with_info_and_location(id) # this function doesn't populate location nor location_id aggregate(:location).where(id: id).map_to(Video).one aggregate(:video_info).where(id: id).map_to(Video).one end end Hanami::Model.migration do change do create_table :videos do primary_key :id foreign_key :location_id, :locations, null: false end end end Hanami::Model.migration do change do create_table :locations do primary_key :id end end end Hanami::Model.migration do change do create_table :video_infos do primary_key :id foreign_key :video_id, :videos, null: false, on_delete: :cascade end end end
Hi everyone, first time here and with a question! I am trying to integrate Webpack (with Babel) for react using the hanami-webpack and hanami-assets gem, but I got into some trouble with import statements.
In my application.html.erb file, i use the
"Uncaught SyntaxError: Cannot use import statement outside a module"
One of the solutions i found online is to put
"type"="module" to package.json to ensure that all .js files are seen as modules and not CommonJS - I tried doing it, but it lead to another error with my Webpack.config.js file, which is using 'require' instead of import. I changed the file extension to Webpack.config.cjs, which resolved the error the server was throwing, but I am still stuck with 'Cannot use import statement outside of module'
Does anyone know how to solve this? Is there a good example of how to integrate React with Hanami? Thanks!