I am trying to obtain the id after the object is build. How do i obtain the id in the following case:
def create
@event = current_customer.events.build(params[:event])
@ev = Event.find(@event)
I am trying to use so i can save the event.id into a specific locations but i am not sure how to grab the id of it build is it possible?
When you use
#build, it is the same as#newso it doesn’t create an object therefore no id is assigned. You should use#create