SearchLogic

授权协议 未知
开发语言 Ruby
所属分类 程序开发、 其他开发相关
软件类型 开源软件
地区 不详
投 递 者 雍骏俊
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

SearchLogic 是基于 Ruby ActiveRecord 的搜索、分页、排序等操作的类库。

安装方法:sudo gem install searchlogic

一个简单的搜索示例代码:

User.all(
:conditions => {
:first_name_contains => "Ben", # first_name like '%Ben%'
:email_ends_with => "binarylogic.com", # email like '%binarylogic.com'
:created_after => Time.now, # created_at > Time.now
:hour_of_created_at => 5 # HOUR(created_at) > 5 (depends on DB type)
},
:per_page => 20, # limit 20
:page => 3, # offset 40, which starts us on page 3
:order_as => "ASC",
:order_by => {:user_group => :name} # order user_groups.name ASC
)
  • [color=red][b]发现还有人在看这个博客,这个 SearchLogic 只支持 Rails 2。Rails 3 有一个类似的插件叫 meta search,后来 meta search 又被重新改写,并改名叫 ransack,功能跟 searchlogic 非常相似,如果你在用 Rails 3,推荐使用 ransack。[/b][/color] [b]参考:[url]http://git

  • This plugin help searching. you can use these methods: Product.name_like("Video") Product.name_not_like("Video").price_gt(5).price_lt(200) Product.name_like_any(["couch", "table"]) Product.name_like_a

  • rd_searchlogic usage例子 Search using conditions on columns Instead of explaining what Searchlogic can do, let me show you. Let’s start at the top: # We have the following model User(id: integer, crea

  • [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 =

  • Searchlogic makes searching models easier than ever with its assortment of named scopes. In this episode I show you how to create simple and advanced searches. sudo gem install searchlogic # config/en

  • Before I use a library in my application I like to glance at the source and try to at least understand the basics of how it works. If you are like me, a nice little explanation from the author is alwa

  • 稍微看了一下,好像挺简单,只是处理了一下参数。 # Automatically makes the form method :get if a Searchlogic::Search and sets # the params scope to :search def form_for(*args, &block) if search_obj = args.fi

相关阅读

相关文章

相关问答

相关文档