[Radiant] Radius tag and send_data method

Enzo Ferro buzman1 at hotmail.com
Tue Nov 6 09:43:24 CST 2007


Hy everybody,
how can I use the "send_data" method in a radius tag?

More details:
in a RoR application I've used the method "send_data" to download e file
stored in a database table in this way:

rhtml code:
<%= link_to 'Download', :action => 'download', :id => file_list.id %>

controller code:
def download
   @file = FileList.find(params[:id])
   @xml = @file.xmlfile #polymorphic associations
   send_data(@xml.file, :type => "txt/xml", :filename =>
"#{@file.filename}")
end

It's work fine, but now in my radiant extension I need a tag that do the
same thing. I've developed this tag:

tag "download" do |tag|

  @file_id = request.parameters[:file]
  @file = FileList.find(:all, :conditions => [ "id = ?", @file_id ])
  @file.each do |file|
     send_data("#{file.xmlfile.file}", :type => "txt/xml", :filename =>
"#{file.filename}")
  end
end

It returs me the error "undefined method send_data for #"

Anyone can help me?

Thanks and greatings
-- 
Posted via http://www.ruby-forum.com/.



More information about the Radiant mailing list