linux系统下ruby怎么生成excel

Python011

linux系统下ruby怎么生成excel,第1张

poi导入一个excel文件,本地运行是可以导入成功的,但是部署到测试环境就在报错。然后本地是windows系统,测试是Linux系统。前台用的是“ajaxFileUpload”插件上传,因为要实现的是上传成功之后,在页面上给一个弹框,提示上传成功。

执行SQL语句

require "dbi"

dbh = DBI.connect("DBI:ODBC:#{db_name}",@user,@password)

sth = dbh.execute(%%1)

提取单条记录

# @database is array of references to anonymous hashes

@database = (

{ name =>"Wild Ginger",

city =>"Seattle",

cuisine =>"Asian Thai Chinese Korean Japanese",

expense =>4,

music =>"\0",

meals =>"lunch dinner",

view =>"\0",

smoking =>"\0",

parking =>"validated",

rating=>4,

payment =>"MC VISA AMEX",

},

# { ... }, etc.

)

sub findRestaurants {

my ($database, $query) = @_

return grep {

$query->{city} ?

lc($query->{city}) eq lc($_->{city}) : 1

and $query->{cuisine} ?

$_->{cuisine} =~ /$query->{cuisine}/i : 1

and $query->{min_expense} ?

$_->{expense} >= $query->{min_expense} : 1

and $query->{max_expense} ?

$_->{expense} <= $query->{max_expense} : 1

and $query->{music} ? $_->{music} : 1

and $query->{music_type} ?

$_->{music} =~ /$query->{music_type}/i : 1

and $query->{meals} ?

$_->{meals} =~ /$query->{meals}/i : 1

and $query->{view} ? $_->{view} : 1

and $query->{smoking} ? $_->{smoking} : 1

and $query->{parking} ? $_->{parking} : 1

and $query->{min_rating} ?

$_->{rating} >= $query->{min_rating} : 1

and $query->{max_rating} ?

$_->{rating} <= $query->{max_rating} : 1

and $query->{payment} ?

$_->{payment} =~ /$query->{payment}/i : 1

} @$database

}

可以gem安装

gem install restful_authentication

或者

如果已经下载了,就解压放到你的rails项目的vendor\plugins\

比如vendor\plugins\restful_authentication

就可以了

使用的话一两句说不清,找里面的readme什么的或者google,看原文的最好