Don't mind me, I fricked up my attribute names :(
This is entirely possible, using the exact syntax I used - you just need to be able to spell!
I can't seem to get this to work, and it seems like a common enough scenario that there must be a solution, but I'm not having any luck with the correct terminology to get a helpful Google result.
I want to do this:
u = User.first
u.clients.find_or_create_by_email('[email protected]')
With the effect that a new Client
is created with user_id = u.id
.
Can I get the nice dynamic finders through a has_many
relationship? If not, why?
Thanks :)