摘要:
concat(string, unused_binding = nil) The preferred method of outputting text in your views is to use the <%="text" %> eRuby syntax. The regular puts andprint methods do not operate as expected i... 阅读全文
posted @ 2009-07-08 15:22
麦飞
阅读(327)
评论(0)
推荐(0)
摘要:
关键字: Rails block view我们可以在application_helper里定义一个admin_area helper方法: ruby代码 moduleApplicationHelper defadmin_area(&block) ifadmin? concatcontent_tag(:div,capture(&black),:class=>'admin'),b... 阅读全文
posted @ 2009-07-08 15:03
麦飞
阅读(220)
评论(0)
推荐(0)
摘要:
action_view/helpers/active_record_helper.rb里的一段代码: ruby代码 moduleActionView classBase @@field_error_proc=Proc.new{|html_tag,instance|"<divclass=\"fieldWithErrors\">#{html_tag}</div>"} cattr... 阅读全文
posted @ 2009-07-08 14:39
麦飞
阅读(343)
评论(0)
推荐(0)
摘要:
我们可以将Task类里的due_at_string这个虚拟属性的生成做成一个plugin: ruby代码 rubyscript/generatepluginstringify_timeruby script/generate plugin stringify_time 这将在vendor/plugins目录生成如下文件: ruby代码 vendor plugins stringify_time -... 阅读全文
posted @ 2009-07-08 10:56
麦飞
阅读(160)
评论(0)
推荐(0)
摘要:
关键字: rails in_groups_of 这次讲的是active_support/core_ext/array/grouping.rb里的in_groups_of方法 ruby代码 #%w(1234567).in_groups_of(3){|g|pg} #["1","2","3"] #["4","5","6"] #["7",nil,nil] # #%w(123).in_groups_of(2... 阅读全文
posted @ 2009-07-08 10:29
麦飞
阅读(1019)
评论(0)
推荐(0)
浙公网安备 33010602011771号