These are chat archives for hanami/chat
Forum https://discourse.hanamirb.org – Code of Conduct http://hanamirb.org/community/#code-of-conduct
Hi all! Could someone please point me where I can find how to define custom schema on entities with attributes of associated records? I have
User that has one
Address so in
class Address < Hanami::Entity attributes do attribute :id, Types::Int attribute :street, Types::String .... attribute :user, Types::Entity(User) end end
There are two problems:
Userconstant unless I do
require_relative './user'- is there any way to solve it on some global level so I do not need to include it in each entity?
require_realtive, because it states on the top of the file what are it's dependencies.
[bookshelf] [INFO] [2017-02-11 15:42:48 +0100] (0.000381s) SELECT "id", "title", "created_at", "updated_at" FROM "books" WHERE ("book"."id" = '1') ORDER BY "books"."id"
I am new in Hanamirb, I have one app on production since couple of days - works like a charm. But I would like to tune logging settings. I would like to hide SQL queries from log entries on production, is it possible?
environment :production do model do logger level: :error end end
:arrow_up: is the way to go? Experimented with similar on my local setup but still seeing SQL statements.
Similar question was asked before, but sadly with no answer :( I’m also curious about this one.
@katafrakt For example if you have such:
# user.rb require_relative './address' class User < Hanami::Entity attributes do attribute :id, Types::Int ... attribute :address, Types::Entity(Address)
# address.rb require_relative './user' class User < Hanami::Entity attributes do attribute :id, Types::Int ... attribute :user, Types::Entity(User)
Then Hanami loads it like -
Address first, then inside address.rb requires relative user.rb which has again
require_relative './address'. So this results in
uninitialized constant Address::User