On Sep 8, 7:10 am, Sijo Kg
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi
> I am calling the following from the problem controller
> @problem=Problem.find(params[:id])
> MailSendingProblem.send_mail_to_group_owner(group_id.to_i,@problem) and
> inside the def send_mail_to_group_owner
>
> ProblemMailer.deliver_to_send_mail_to_user(user.name,pemailaddress.email,pr
oblem)
>
> Now in the view to_send_mail_to_user.rhtml I have
> Number : <%= @problem.number%>
> Title : <%= @problem.title%>
> Urgency : <%=h ProblemUrgency.find(@problem.problem_urgency_id).name
> if !...@problem.problem_urgency_id==nil?%>
>
> Priority : <%=h
> ProblemPriority.find(@problem.problem_priority_id).name if
> !...@problem.problem_priority_id==nil?%>
>
Given the time you;ve been posting to this list you should really have
read about associations.
Give problem a problem_urgency (or even just urgency) association and
the lines above become things like
@problem.problem_urgency.name if @problem.problem_urgency
Not sure what collections have got to do with any of this.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---