2011-03-06 67 views
0

我想在我的Ruby on Rails网站上嵌入Google文档查看器(http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html),它会一直显示“对不起,这种类型的文件不支持查看”。我的Rails代码使用由send_file调用,它看起来是这样的:带导轨的Google文档查看器

send_file(File.join(@document.path, @document.filename), {:filename => @document.name, :type => @document.filetype}) 

在服务器日志中,我可以看到,该文件被发送,但文档查看器不显示它。有没有人有任何想法,我可能会解决这个问题?

+0

你用不同的文件格式试试吗? – izzzooo 2012-01-05 10:01:59

回答

0

我也在努力做到这一点。

有人在我的代码尝试链接日历与此助手,这是一个日历,它不是为文件,但也许它可以给我们一个想法。

def current_user_calendar 
    GCal4Ruby::Calendar.to_iframe(current_user.email, :width => "500", :height => "200", :viewMode => "AGENDA").html_safe 
    end 

    def best_calendar 
    if current_user.can_show?(:system_calendar) 
     id = Settings.calendar_id 
    else 
     id = current_user.email 
    end 
    GCal4Ruby::Calendar.to_iframe(id, :width => "1120", :mode => "week").html_safe 
    end