Ruby Ruport实践—报表参数实现(二)
本例在 Ruby Ruport实践—报表参数实现 的基础上进行改造,实现报表执行定义时报表参数的增、删、改操作
一、修改views/report_executions/edit.html.erb
不仅显示在新建报表执行时保存的报表参数,还可动态显示剩余的参数(这里控制参数最多可定义5个),这样可避免遗忘定义报表参数或需要增加报表参数的现象
<h1>Editing report_execution</h1>
<% form_for(@report_execution) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :execute_code %>:
<%= f.text_field :execute_code %>
</p>
<p>
<%= f.label :execute_name %>:
<%= f.text_field :execute_name %>
</p>
<p>
<%= f.label :report_definition_id %>:
<%=report_definitions_control%>
</p>
<p>
<%= f.label :report_template_id %>:
<%=report_templates_control%>
</p>
<h3>Report Parameters</h3><p/>
<!-- 显示已有的报表参数 -->
<%if @report_parameters.length>0%>
<%for i in 0..@report_parameters.length-1%>
<p>
<%=hidden_field_tag 'parameter_id[]',@report_parameters[i].report_parameter_id%>
Parameter<%=i+1%>: <%=text_field_tag 'parameter_name[]',@report_parameters[i].parameter_name%>
Value<%=i+1%>: <%=text_field_tag 'parameter_value[]',@report_parameters[i].parameter_value%>
</p>
<%end%>
<%end%>
<!--显示其他的参数框,若需要添加参数可在此操作-->
<%for i in @report_parameters.length+1..5%>
<p>
Parameter<%=i%>: <%=text_field_tag 'parameter_other_name[]'%>
Value<%=i%>: <%=text_field_tag 'parameter_other_value[]'%>
</p>
<%end%>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Show', @report_execution %> |
<%= link_to 'Back', report_executions_path %>
二、修改ReportExecutionsController
主要修改cr
相关文档:
下文转自:
http://www.cnblogs.com/watir/archive/2009/04/25/1443440.html
ruby文件从命令行中接收参数
在命令行方法执行ruby文件时,需要从命令行中传入参数,可以使用全局变量:ARGV
如有ruby 文件test.rb,内容如下:
1 def hello(a)
2 puts a
3 end
4
5 ......
Prepare
1. Download 'OCI 1.x.x.rb' (it's VERY important - execution MUST be *.rb)
2. Download 'oci8lib.so'
Install
1. Copy 'OCI8.rb' to .../ruby/lib/ruby/site_ruby/1.8/DBD/OCI8
2. Copy 'oci8.rb' to .../ruby/lib/ruby/site_ruby/1.8
3. Copy 'oci8lib.so' to .../ruby/lib/ruby/site_ruby/1.8/i386-msv ......
1、安装ubuntu
一路next,记住安装英文版。待安装完毕后,首先选择“软件源”,系统--系统管理-软件源,国内一般选择的是:http://ubuntu.cn99.com/ubuntu;接着安装中文包,选择软件源就是为了下载软件的速度更快,安装完成后重启ubuntu,重启后会提示是否改变某些文件夹名称,选择“否”,防止系统对 ......
转自 http://zhujg.javaeye.com/blog/355040
首先 安装 cygwin
cygwin 要安装的插件是
默认的+ make + gcc + libiconv
+ openssl
cygwin下需要编译原文件
到ruby-lang(http://ruby-lang.org/)
下载ruby-1.9.1-p0.tar.gz
tar xvf ruby-1.9.1-p0.tar.gz
cd
ruby-1.9.1-p0
./configure
make && make in ......
Installing Ruby from source is my preferred method, although in Ubuntu Feisty you can supposedly install it with apt-get install ruby
now. Here’s the essential packages needed to get a source build working right though and the process I just went through:
sudo apt-get install build-essentia ......