schroedi wrote:
class Athlet < ActiveRecord::Base
after_create :notify_user
end
AthletMailer:
class AthletMailer < ActionMailer::Base
after_create :notify_user
def notify_user
AthletMailer.deliver_welcome_email(user)
end
def welcome_email(user)
recipients user.email
from "My Awesome Site
Notifications<[email protected]>"
subject "Welcome to My Awesome Site"
sent_on Time.now
body {:user => user, :url => "http://example.com/login"}
content_type "text/html"
# use some_other_template.text.(html|plain).erb instead
template "some_other_template"
end
def welcome(user)
@recipients athlet.email
@subject = "TEST User Anmeldung"
end
end
Du hast da was falsch verstanden. AthletMailer ist ja kein Model im
Sinne von ActiveRecord. In diesem Fall bedeutet es, dass du deine
Definition von notify_user in das Athlet Model packen muss und es
ueberhaupt nicht im AthletMail brauchst. Generell braucht man in
ActionMailer Klassen nur die Methoden um Emails zu schicken (hier
brauchst du also nur die welcome_email Methode).
Urban
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug