I don’t get what class Test is for, or where the
registration model is, but remember that registrationS
is the collection object. I think you want something
like
after_create {
self.registrations << Registration.new
}
Cheers,
B Gates
I want to automatically create a registration entry
when I add a new
user to my application. This works fine, but it’s not
automatic:
class User < ActiveRecord :: Base
has_many :registrations
end
class Test
user = User.new
user.registrations.create
end
I’d like the User class to do that automatically. I
tried this but it
didn’t work:
class User < ActiveRecord :: Base
has_many :registrations
after_create {
self.registrations.create
}
end
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around