Topic: Find Or Create By (attribute) how can i tell if its a new record?

Hello
Im using find or create by to create some events in a table.
code :

event = user.events.find_or_create_by_x

(x being the attribute)

Is there a way i can find out if this find or create action returns an existing record or creates a new record?
I was thinking of doing something with the event.id and tracking that but was wondering if there is something built into Rails that will tell me if its a new record or not.
thanks

Re: Find Or Create By (attribute) how can i tell if its a new record?

There is a new_record? and persisted? methods on AR models. Read this

Re: Find Or Create By (attribute) how can i tell if its a new record?

Thank you.
that is exactly what i was looking for :-)