This is probly just an email typo, but if not, it should be <%@comments_text
%> in your view, instead of <%= comments_text %>...
On 6/9/05, Belorion <belorion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I may just be blind after too many hours of coding, but I''ve
> encountered what seems to be a very strange bug.
>
> I''ve got an ActionMailer called Mailman:
>
> class Mailman < ActionMailer::Base
> def comments(name, email, comments_text, sent_at = Time.now)
> @subject = ''Mailman#comments''
> @body = { "name" => name, "email" =>
email, "comments_text"
> => comments_text }
> @recipients = ''myemail-+LBmYUDmh58@public.gmane.org''
> @from =
''anotheremail-+LBmYUDmh58@public.gmane.org''
> @sent_on = sent_at
> @headers = {}
> end
> end
>
> I create a mail object in my controller:
>
> def submit_comment
> name = @params[:name]
> email = @params[:email]
> comments_text = @params[:content]
> email = Mailman.create_comments( name, email, comments_text )
> # email = Mailman.deliver_comments( name, email, comments_text )
> # redirect_to( :controller => ''news'', :action
=> ''list'' )
> render_text( "<pre>" + email.encoded +
"</pre>" )
> end
>
>
> And my template: (comments.rhtml)
>
> From: <%= @name %>
> Email: <%= @email %>
> Comments:
>
> <%=comments_text %>
>
>
> Now for the strange part... @name and @email are returning expected
> values, but @comments_text does not. @comments_text is nil. I did a
> render_text from within the controller only on comments_text, which is
> being passed to the mailer, and it seems okay. My mind was boggling
> why it wasn''t getting to the template. So I did a <%>
instance_variables %> on the template, and lo and behold, there is an
> instance variable called @commments (yes, with 3 m''s). Where the
heck
> did this come from?
>
> $> grep -R "commm" *
>
> >From the root of my rails app, and I get *nothing*
>
> Where in the heck is @commments coming from? Why is @comments_text
> not getting to the template? Part of me is afraid that my hours of
> coding have left me impaired, but I can''t seem to figure this out.
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Chris Boone
http://hypsometry.com/ : website edification
http://uvlist.org/ : free classifieds for the Upper Valley