David Clements
2006-Sep-05 20:22 UTC
Re: Bug? ApplicationHelper methods are added to XML builder object
On 9/5/06, David Clements <clements-UWkI3MzZw7X2fBVCVOL8/A@public.gmane.org> wrote:> > I know this is weird and you might not believe me but I have confirmed > this Rails version 1.1.6. > > I have an .rxml view file that produces RSS. In this file is a call to > xml.title(@feed_title) which in normal cases creates <title>Some cool rss > feed</title> . However, after awhile I start seeing this error: > > ActionView::TemplateError (wrong number of arguments (1 for 0)) on line #6 > of app/views/autonomy/query/rss.rxml: > 3: xml.rss "version" => "2.0","xmlns:dc" => "http://purl.org/dc/elements/1.1" > do > 4: xml.channel do > 5: logger.error("FOOOOOO" + xml.title.to_s) > 6: xml.title @feed_title > > > After some digging I have discovered that the methods that in > ApplicationHelper have been magically added to the xml builder object. > This happens when I call a separate controller which does an ''include > ApplicationHelper'' in it. Thoughts? > > logger output > Rendering autonomy/query/rss > FOOOOOOCollective Intellect, Inc. > > File: Excerpt: ApplicationHelper > > > ############################################################################# > # Some layouts require a title method. > def title > @title || "Collective Intellect, Inc." > end > > File Excerpt: EmailReportController > > require ''ostruct'' > require ''analysis/email_report_helper'' > include ApplicationHelper > include GruffHelper > include Analysis::EmailReportHelper > > require ''base64'' > > File: rss.rxml > xml.instruct! > > xml.rss "version" => "2.0","xmlns:dc" => "http://purl.org/dc/elements/1.1" > do > xml.channel do > xml.title @feed_title > xml.link url_for(:only_path => false) > xml.pubDate CGI.rfc1123_date(Time.now) > xml.description h(@description) > @results.each do |result| > xml.item do > xml.title result.title + "( #{result.weight} )" > xml.link result.reference > xml.description result.message > xml.pubDate CGI.rfc1123_date(Time.parse(result.date)) > xml.guid result.reference > xml.author result.author > xml.summary result.summary > xml.relevance result.weight > end > end > > end > > end >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---