易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

ruby文件从命令行中接收参数(全局变量:ARGV)


下文转自:
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

5  ......

ruby Bignum Dir 学习

Bignum
+        加
-        减
*        乘
/        除
**        指数操作2**2 意思是2的平方
<=>        大于, ......

install ruby on cygwin

转自 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 1.8.6 from Source on Ubuntu

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 ......

Ruby语言学习系列 基本的ruby语法


Ruby语言学习系列--基本的ruby语法
 
1.     基本的ruby语法
1.1      变量、常量和类型
1)      定义变量
变量类型
描述
示例
局部变量(或伪变量)
以小写字母或下划线卡头
var    _var
全局变量
以$开头
$ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号