diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-24 20:34:23 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-24 20:34:23 -0600 |
commit | a4e461bccee482c40e69be9310ba12de5d7da59b (patch) | |
tree | 393c62df15091d88083ad4841d95e9d0083534c3 /app/controllers/services | |
parent | 92994313506152f366d91f845aa1ff59e84b0acd (diff) |
Fixes de addresses_controller
Diffstat (limited to 'app/controllers/services')
-rw-r--r-- | app/controllers/services/create_address_service.rb | 3 | ||||
-rw-r--r-- | app/controllers/services/update_address_service.rb | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/services/create_address_service.rb b/app/controllers/services/create_address_service.rb index 7b67af2..5ded4f7 100644 --- a/app/controllers/services/create_address_service.rb +++ b/app/controllers/services/create_address_service.rb @@ -7,8 +7,7 @@ module Services def call if already_existing_address.nil? - @address = @user_account.address.new(@params) - @address.save + @address = @user_account.addresses.create(@params) else add_address_to_user_addresses @address = already_existing_address diff --git a/app/controllers/services/update_address_service.rb b/app/controllers/services/update_address_service.rb index 9f1ce54..26a596e 100644 --- a/app/controllers/services/update_address_service.rb +++ b/app/controllers/services/update_address_service.rb @@ -19,6 +19,7 @@ module Services return :unprocessable_entity unless @address.update(@params) else add_address_to_user_addresses + @address.user_account_addresses.find_by(user_account_id: @user_account.id).destroy @address.destroy if @address.user_accounts.count.zero? @address = already_existing_address end |