我正在尝试在我的Ruby on Rails网站上嵌入Google文档查看器(http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html)并且它一直显示“抱歉” ,这种类型的文件不支持查看“。我的rails代码使用send_file调用,如下所示:
send_file(File.join(@document.path, @document.filename), {:filename => @document.name, :type => @document.filetype})
在服务器日志中,我可以看到文件正在发送,但文档查看器没有显示它。有没有人有任何想法我怎么能解决这个问题?
答案 0 :(得分: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