Forum https://discourse.hanamirb.org – Code of Conduct http://hanamirb.org/community/#code-of-conduct
timriley on add-benchmarks
Tidy benchmarks Add tilt benchmark (compare)
timriley on render-env-via-reader-effect
Update profile_view (compare)
timriley on render-env-via-reader-effect
Tweak benchmarks Remove unneeded effect reader Back to one effect for render_e… and 1 more (compare)
waiting-for-dev on robust_setup
Make the setup of Hanami more r… (compare)
waiting-for-dev on robust_setup
Make the setup of Hanami more r… (compare)
waiting-for-dev on robust_setup
Make the setup of Hanami more r… (compare)
waiting-for-dev on robust_setup
Make the setup of Hanami more r… (compare)
waiting-for-dev on robust_setup
Make the setup of Hanami more r… (compare)
depfu[bot] on check
Pin dry-core to version 0.8.1 (compare)
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”).
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?
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:
new
command like I did with the rest of the options: hanami new pistachio --test=rspec --database=postgres --template=erb
UpdateUser.new.call(user)
. With this approach you can also unit-test the domain without mocking the db.
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
Failed to load resource: the server responded with a status of 404 (Not Found)
for a lot of assets. However, looking in the public\assets
folder the different app folders have those assets that are reported missing.
@/all Hanami v2.0.0 first beta!
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?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 thepublic\assets
folder 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?
hanami assets precompile
command so everything is setup as described here.
public/assets
level. We use command in the docker-compose to copy this with deploy.
I just upgraded our Hanami application from alpha8 to beta1. The project was setup using the Hanami 2 template. We now get this error when running rspec:
$ bundle exec rake
An error occurred while loading spec_helper.
Failure/Error: require "hanami/prepare"
NoMethodError:
undefined method `source_dirs' for #<Hanami::Configuration:0x000000010636bad0 @config=#<Dry::Configurable::Config ... (see full stack trace in thread)
# ./config/app.rb:13:in `<class:App>'
# ./config/app.rb:6:in `<module:MyApp>'
# ./config/app.rb:5:in `<top (required)>'
# ./spec/spec_helper.rb:6:in `require'
# ./spec/spec_helper.rb:6:in `<top (required)>'
Anyone here knowing anything about this source_dirs
, has it been renamed? I can't find anything in the Hanami changelog about this. This is my config/app.rb
:
# frozen_string_literal: true
require "hanami"
module MyApp
class App < Hanami::App
config.sessions = :cookie, {
key: "my-app.session",
secret: settings.session_secret,
expire_after: 60 * 60 * 24 * 365 # 1 year
}
config.source_dirs.component_dirs.add "serializers" # <--- crashes here
end
end
This code worked in Hanami alpha8.