Merge pull request 'Allow the creation of guests associated to no group' (#174) from allow-creation-groupless-guests into main
Reviewed-on: #174
This commit is contained in:
commit
b38e845b90
@ -5,7 +5,7 @@ require 'csv'
|
||||
class GuestsController < ApplicationController
|
||||
def index
|
||||
render json: Guest.all.includes(:group)
|
||||
.joins(:group)
|
||||
.left_joins(:group)
|
||||
.order('groups.name' => :asc, name: :asc)
|
||||
.as_json(only: %i[id name status], include: { group: { only: %i[id name] } })
|
||||
end
|
||||
|
@ -25,7 +25,7 @@
|
||||
#
|
||||
class Guest < ApplicationRecord
|
||||
acts_as_tenant :wedding
|
||||
belongs_to :group
|
||||
belongs_to :group, optional: true
|
||||
|
||||
enum :status, {
|
||||
considered: 0,
|
||||
|
@ -16,7 +16,7 @@ RSpec.describe Guest, type: :model do
|
||||
end
|
||||
end
|
||||
|
||||
it { should belong_to(:group) }
|
||||
it { should belong_to(:group).optional }
|
||||
|
||||
describe 'scopes' do
|
||||
describe '.potential' do
|
||||
|
@ -41,7 +41,7 @@ RSpec.describe 'guests', type: :request do
|
||||
properties: {
|
||||
guest: {
|
||||
type: :object,
|
||||
required: %i[name group_id status],
|
||||
required: %i[name status],
|
||||
properties: {
|
||||
name: { type: :string },
|
||||
group_id: { type: :string, format: :uuid },
|
||||
@ -70,6 +70,7 @@ RSpec.describe 'guests', type: :request do
|
||||
properties: {
|
||||
guest: {
|
||||
type: :object,
|
||||
required: %i[name status],
|
||||
properties: {
|
||||
name: { type: :string },
|
||||
group_id: { type: :string, format: :uuid },
|
||||
|
Loading…
x
Reference in New Issue
Block a user