所以,我正在使用Jquery,并且有两个数组都有多个值,我想检查第一个数组中的所有值是否都存在于第二个数组中.
例如,例1 ......
数组A包含以下值
34,78,89
数组B包含以下值
78,67,34,99,56,89
这将返回真实
......例2:
数组A包含以下值
34,78,89
数组B包含以下值
78,67,99,56,89
这将返回false
......例3:
数组A包含以下值
34,78,89
数组B包含以下值
78,89
这将返回false
到目前为止,我试图解决这个问题:
任何人都可以投入任何光线都会很棒.
我正在Rails(3.1.1)中的最新版本的Prawn库(v1.0.1rc)中创建一个pdf文件,当我运行我的代码时,它会将PDF生成到应用程序的根目录中.
我不想要这个.我希望它将输出呈现到用户的浏览器窗口中,而不将其本地保存到服务器.
请告诉我如何实现这一目标.这是我的文件:
views/foo/show.pdf.erb:
<%=
require 'prawn'
pdf = Prawn::Document.new(:page_size => 'LETTER', :page_layout => :landscape, :margin => 50, :top_margin => 20, :bottom_margin => 50)
.....
render_file("foo.pdf")
%>
Run Code Online (Sandbox Code Playgroud)
controllers/foo_controller:
class AuditsController < ApplicationController
before_filter :authenticate_user!
layout 'application'
can_edit_on_the_spot
respond_to :html, :xml, :js, :pdf
def index
@audits = Audit.all
respond_with @audits
end
def show
@audit = Audit.find(params[:id])
respond_with @audit do |format|
format.pdf { render :layour => false }
end
end
Run Code Online (Sandbox Code Playgroud)