searchLogic心得

本文介绍了一个名为searchLogic的好用查询插件,演示了如何使用该插件进行复杂查询,包括对关联表字段的查询及如何在不同场景下定制查询选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[b]searchLogic好用的查询插件:[/b]

belongs_to :conversation
has_many :people


在conversation/advsearch中能这样查询people中的字段:

text_field_tag "search[people_name_like]", params[:search][:people_name_like], :is_focus => true, :class => :nofixed


如果是本表的字段可以这样:

text_field_tag "conversation[tag ]", params[:conversation][:tag], :is_focus => true, :class => :nofixed

text_field_tag "search[tag _like ]", params[:search][:ta g_like ], :is_focus => true, :class => :nofixed

=calendar_date_select_tag "search[reported_at_gte]",params[:search][:reported_at_gte], :popup=> :force, :class=> "calendar_report nofixed"


在共用一个文件时,有些页面不用查询某些字段:

- unless defined?(without) && without.include?(:state)

列表页面加:=render :partial => 'advsearch', :locals => {:without => [:creator, :manage, :dispatched_at, :destroy_adv]}

所产生的链接为:=link_to_function '高级查询', "newDiv('adv-search')", :class=> "icon-16px-box j-icon i-view"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值