rubyonrails插件Searchlogic.docVIP

  • 1
  • 0
  • 约1.48万字
  • 约 11页
  • 2018-02-06 发布于河南
  • 举报
rubyonrails插件Searchlogic

Index ? File: README (no frames) Class List Method List File List Searchlogic Searchlogic makes using ActiveRecord named scopes easier and less repetitive. It helps keep your code DRY, clean, and simple. Helpful links Documentation: /projects/binarylogic/searchlogic Repository: /binarylogic/searchlogic/tree/master Issues: /binarylogic/searchlogic/issues Google group: /group/searchlogic Railscast: /episodes/176-searchlogic Before contacting me directly, please read: If you find a bug or a problem please post it in the issues section. If you need help with something, please use google groups. I check both regularly and get emails when anything happens, so that is the best place to get help. This also benefits other people in the future with the same questions / problems. Thank you. Install use Install the gem from rubyforge: sudo gem install searchlogic Now just set it as a dependency in your project and you are ready to go. You can also install this as a plugin: script/plugin install git:///binarylogic/searchlogic.git See below for usage examples. 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, created_at: datetime, username: string, age: integer) # Searchlogic gives you a bunch of named scopes for free: User.username_equals(bjohnson) User.username_equals([bjohnson, thunt]) User.username_equals(a..b) User.username_does_not_equal(bjohnson) User.username_begins_with(bjohnson) User.username_not_begin_with(bjohnson) User.username_like(bjohnson) User.username_not_like(bjohnson) User.username_ends_with(bjohnson) User.username_not_end_with(bjohnson) User.age_greater_than(20) User.age_greater_than_or_equal_to(20) User.age_less_than(20) User.age_less_than_or_equal_to(20) User.username_null User.username_not_null User.username_blank Any named scope Searchlogic creates is dynamic and created via me

文档评论(0)

1亿VIP精品文档

相关文档