Fix member creation when database is empty
This commit is contained in:
parent
ae4a3c62e4
commit
5a35a72ac4
@ -25,7 +25,7 @@ class MembersController < ApplicationController
|
|||||||
|
|
||||||
# POST /members
|
# POST /members
|
||||||
def create
|
def create
|
||||||
@member = Member.new(member_params.merge(number: Member.maximum(:number) + 1))
|
@member = Member.new(member_params.merge(number: (Member.maximum(:number) || 0) + 1))
|
||||||
|
|
||||||
if @member.save
|
if @member.save
|
||||||
@member.reset_status!
|
@member.reset_status!
|
||||||
|
Loading…
Reference in New Issue
Block a user