Skip to content

Commit

Permalink
Remove model association presets
Browse files Browse the repository at this point in the history
Fixes compile error resulting from including the same mixin twice.
  • Loading branch information
akadusei committed Sep 11, 2024
1 parent 660efc8 commit e249188
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased] -

### Removed
- Remove model association presets

## [1.3.0] - 2024-09-11

### Changed
Expand Down
36 changes: 8 additions & 28 deletions src/shield/models/user.cr
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
module Shield::User
macro included
{% if Avram::Model.all_subclasses.find(&.name.== :BearerLogin.id) %}
include Shield::HasManyBearerLogins
{% end %}
# include Shield::HasManyBearerLogins
# include Shield::HasManyEmailConfirmations
# include Shield::HasManyLogins
# include Shield::HasManyOauthClients
# include Shield::HasManyOauthGrants
# include Shield::HasManyPasswordResets

{% if Avram::Model.all_subclasses.find(&.name.== :EmailConfirmation.id) %}
include Shield::HasManyEmailConfirmations
{% end %}

{% if Avram::Model.all_subclasses.find(&.name.== :Login.id) %}
include Shield::HasManyLogins
{% end %}

{% if Avram::Model.all_subclasses.find(&.name.== :OauthClient.id) %}
include Shield::HasManyOauthClients
{% end %}

{% if Avram::Model.all_subclasses.find(&.name.== :OauthGrant.id) %}
include Shield::HasManyOauthGrants
{% end %}

{% if Avram::Model.all_subclasses.find(&.name.== :PasswordReset.id) %}
include Shield::HasManyPasswordResets
{% end %}

{% if Avram::Model.all_subclasses.find(&.name.== :UserOptions.id) %}
include Shield::HasOneUserOptions
{% elsif Lucille::JSON.includers.find(&.name.== :UserSettings.id) %}
include Shield::UserSettingsColumn
{% end %}
# include Shield::HasOneUserOptions
# #include Shield::UserSettingsColumn

column email : String
column password_digest : String
Expand Down

0 comments on commit e249188

Please sign in to comment.