Select not working properly

Hi Guys,

I have created a form where a user can select from a drop down list of
names. Based on the selection, a value is passed and appropriate email
is looked up.

Then, I call actionmailer to deliver the email.

Problem is that it seems that (from log file) rhtml file is passing
correct value to sendmail_qualitylead action, however, toEmail in the
action is either not getting set or not getting passed appropriately
(sql command seems to be executed as shown in log file).

.rhtml file ->
<%=form_tag :controller=>“xyz”, :action=>“sendmail_qualitylead”%>

......

xyz_controller ->
def sendmail_qualitylead
body=params[:lead]
toEmail = Contact.find_by_sql([“select email from contacts where
id=?”,body[“contactID”]])
Notifier.deliver_quality_lead_for_flying_club(body, toEmail)
redirect_to :action => “dosearch”
end

Notifier.rb ->
def quality_lead_for_flying_club(body, toEmail)
@subject = ‘Quality Lead’
@body = body
@recipients = toEmail
@cc = body[“senderEmail”]
@from = “supp [email protected]
@sent_on = Time.now
@headers = {}
content_type(“text/html”)
end

I have spent almost a day stuck at this point :frowning: and I will really
appreciate any help.

Thanks

Rajat

Name : <%=select(:lead, :contactID, @DropDown)%>

On 20 Jan 2008, at 16:57, Rajat G. wrote:

correct value to sendmail_qualitylead action, however, toEmail in the


xyz_controller ->
def sendmail_qualitylead
body=params[:lead]
toEmail = Contact.find_by_sql([“select email from contacts where
id=?”,body[“contactID”]])
to_Email will be an instance of Contact here, but it looks like you
are expecting it to be the email address itself.
Try passting toEmail.email to deliver_quality_lead_for_flying_club

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs