Plug-ins using railswhere

2010-11-02  来源:本站原创  分类:Ruby  人气:106 

Address: http://code.google.com/p/railswhere/
Project directory in the dos window: Ruby script / plugin install http://railswhere.googlecode.com/svn/tags/railswhere

Example:

@properties = Property.find(:all, :conditions => Where{|w|
      w.and "apply_number like ?", "%#{params[:apply_number]}%" if params['c_apply_number']
      w.and "creator like ?", "%#{params[:creator]}%" if params['c_creator']
      w.and "p_name like ?", "%#{params[:p_name]}%" if params['c_p_name']
      w.and "agent_person like ?", "%#{params[:agent_person]}%" if params['c_agent_person']
      w.and "apply_date between datetime(?) and  datetime(?)",
                  "#{date_from_param(params[:fromDate])}",
                  "#{date_from_param(params[:toDate])}" if params['c_range']
      })

Note:

Download this plug-in can be run directly in the Rails2.1.2 environment, if it is 2.3.4 (I only tested the two versions), you need to make the following changes to the small

# file path RAILS_ROOT/vendor/railswhere/lib/where.rb  About 169 lines  

# 2.1.2
@criteria = ActiveRecord::Base.send(:sanitize_sql, criteria)

# 2.3.4
@criteria = ActiveRecord::Base.send(:sanitize_sql, criteria, nil)
相关文章
  • JAVA open-source Encyclopedia 2009-04-13

    【Web development framework LazyJ】 → LazyJ is a Java Web Application Date: Sunday, 07 Dec 2008 22:36 LazyJ is a Java Web application development framework. Including: <LI> a very quick template engine, the engine automatically be able to ease deposit

  • eclipse plug-in installation method 2009-10-15

    + plug-ins eclipse platform eclipse is easy way to expand, eclipse plug-ins installed in two ways: 1. One is the built-in installed, or download the plug-ins after the extract, and then, after extracting the plugins and features plug-ins directory of

  • ssh page (more examples) 2010-03-29

    -------------------------------------------------- ------------------- First, a page of the bean: package com.leatherstore.other; public class Page { /** If there are previous */ private boolean hasPrePage; /** Is there a next page */ private boolean

  • Struts1 basic configuration 2008-07-11

    The following records Struts1 basic configuration. 1, download Struts1.3 Links are as follows: http://struts.apache.org/download.cgi # struts1310 Second, copy all of the following packages lib to the project WEB-INF \ LIB next. 3, modify the web.xml

  • are integrated struts and spring 2010-04-19

    One way to integrate Struts and Spring - -- Recently using Struts, Spring made a program, read a lot of this information and code. This is the Struts and Spring work together a summary of the work needs to be done. Struts and Spring work together, th

  • WordPress article will simultaneously send to Twitter, microblogging Sina, Sohu microblogging, QQ microblogging, muttering, happy, everyone 2011-05-19

    Nothing these days, Forece began tossing, trying to build a WordPress blog with their own sync to all community sites and microblogging above. A lot of articles online search, most of which are achieved by muttering. But it also uses other methods. H

  • struts1 初始化流程说明 2014-03-24

    struts初始化起始于ActionServlet.正如其名,它是Servlet,按照Servlet的声明周期,struts的初始化放在了init方法之中. public void init() throws ServletException { // struts初始化流程放入try/catch中,这样可以更好的处理未捕获的异常或错误 try { // 1. 初始化内部国际化信息 initInternal(); // 2. 判断convertNull,进行特殊类型转换器注册 initOther

  • flash tutorial examples: Plug waving colorful flags to construction 2010-03-30

    [Results] [1b] plug in bunting. Swf [/ 1b] (15.42 KB) Downloads: 496 2007-8-10 15:51 [Requirements] 1, to prevent jitter up and down near the flag pole 2, so that when the flag in the smooth rolling without delay [Purpose] Master guide to use layers

  • Ever since railswhere, multi-condition query will not have to panic 2010-03-17

    railswhere web site: http://code.google.com/p/railswhere/ rails plugin install URL http://railswhere.googlecode.com/svn/tags eg 1 common @companys = Company.find(:all, :conditions => Where{|w| w.and "companyname like ?", "#%{@companyname

  • Official Google chrome plug Tutorial 2010-04-20

    JE has a way to see the article on: http://www.javaeye.com/topic/646674 content is to do two chrome plug-in, saw a lot of people are interested in this, little brother to go online read over the pages of the special , finally found the official chrom

  • Web game design and preparation of plug: QQ skyscraper [1] (basic skills) 2010-05-25

    Web game preparation is very simple plug-in does not need to study the source code, do not know how to compile knowledge, only analysis sent to the server and the server sends to the local packet can be written. But if you want to analyze the data as

  • Improved farm income for all of my dishes plug 2010-06-19

    Made in the forum before I harvest them plug the code (see the article "stolen helpless to write a plug-income food"), hey, who really more concerned, but also on the home page! Two days to improve the code a bit, adjusted his structure, design

  • Web game design and preparation of plug: QQ skyscraper next [second] (login game) 2010-07-05

    On a paper that the production plug of the first step is to connect with the game, which landed the game. QQ games for it, there are two methods of landing the game. One is the landing of space and then landing the game, QQ farms, QQ games grab a par

  • Web game design and preparation of plug: QQ skyscraper [2] (login game) 2010-07-05

    On a paper that the production plug of the first step is to connect with the game, which landed the game. QQ games for it, there are two methods of landing the game. One is the landing of space and then landing the game, QQ farms, QQ games grab a par

  • VMware host can not plug cable communication with the virtual machine how to solve 2010-07-25

    VMware host can not plug cable communication with the virtual machine how to solve? 2010-04-02 16:09 Method, when the host did not have a network card or network card (no plug wires) of the case, it can be set: 1, the virtual machine's network card c

  • jQuery: how to plug in the code page and the custom alias 2010-08-17

    As we all know, jQuery is a library with the $ symbol as an alias, but is and has been using other types of libraries, other libraries are also useful in the $ symbol as an alias, this function will lead to conflict. Therefore, more time is recommend

  • Mobile hard disk on a plug crash 2010-08-26

    Problem records: Use: PartitionMagic 8.0 The local hard drive D, E, F disk after the merger, mobile hard drive can not read Plug in HDD, the machine crashes leave all the other programs can not run -------------------------------------------------- -

  • rails upload file _ Plug 2010-09-08

    rails upload file Plug: paperclip 1, model First, the model file to add the following code: has_attached_file :photo , :styles => { :medium => "300x300", :thumb => "100x100" } Second, the database migration file And then modif

  • Plug-ins using railswhere 2010-11-02

    Address: http://code.google.com/p/railswhere/ Project directory in the dos window: Ruby script / plugin install http://railswhere.googlecode.com/svn/tags/railswhere Example: @properties = Property.find(:all, :conditions => Where{|w| w.and "apply_n

  • Js pages use to plug right shielding feature pdf 2010-11-13

    Such as the title, Js pages use to plug right shielding feature pdf