Skip to main content

Lombok Gotchas

· 2 min read

When building out your domain model it is tempting to annotate your entities with @Data.

@Data is a shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, @Setter on all non-final fields, and @RequiredArgsConstructor [^1].

Avoid Rails Default Scopes

· One min read

A common mistake when beginning to use Rails is sprinkling all the models with default scopes specifying order.

class Foo < ActiveRecord::Base
default_scope { order(name: :asc) }
end

This will add order by's to query even when the order does not matter.