Credit where credit is due. Thanks @radar!
This commit is contained in:
parent
fc8151ac49
commit
82d2a806da
21
README.md
21
README.md
|
@ -7,7 +7,7 @@ greatly from MetaSearch, and _backwards compatibility is not a design goal._
|
||||||
Ransack enables the creation of both simple and [advanced](http://ransack-demo.heroku.com)
|
Ransack enables the creation of both simple and [advanced](http://ransack-demo.heroku.com)
|
||||||
search forms against your application's models. If you're looking for something that
|
search forms against your application's models. If you're looking for something that
|
||||||
simplifies query generation at the model or controller layer, you're probably not looking
|
simplifies query generation at the model or controller layer, you're probably not looking
|
||||||
for Ransack (or MetaSearch, for that matter). Try
|
for Ransack (or MetaSearch, for that matter). Try
|
||||||
[Squeel](http://metautonomo.us/projects/squeel) instead.
|
[Squeel](http://metautonomo.us/projects/squeel) instead.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
@ -49,7 +49,7 @@ requires very little setup effort.
|
||||||
If you're coming from MetaSearch, things to note:
|
If you're coming from MetaSearch, things to note:
|
||||||
|
|
||||||
1. The default param key for search params is now `:q`, instead of `:search`. This is
|
1. The default param key for search params is now `:q`, instead of `:search`. This is
|
||||||
primarily to shorten query strings, though advanced queries (below) will still
|
primarily to shorten query strings, though advanced queries (below) will still
|
||||||
run afoul of URL length limits in most browsers and require a switch to HTTP
|
run afoul of URL length limits in most browsers and require a switch to HTTP
|
||||||
POST requests.
|
POST requests.
|
||||||
2. `form_for` is now `search_form_for`, and validates that a Ransack::Search object
|
2. `form_for` is now `search_form_for`, and validates that a Ransack::Search object
|
||||||
|
@ -59,7 +59,7 @@ If you're coming from MetaSearch, things to note:
|
||||||
the ActiveRecord adapter) via a call to `Search#result`. If passed `:distinct => true`,
|
the ActiveRecord adapter) via a call to `Search#result`. If passed `:distinct => true`,
|
||||||
`result` will generate a `SELECT DISTINCT` to avoid returning duplicate rows, even if
|
`result` will generate a `SELECT DISTINCT` to avoid returning duplicate rows, even if
|
||||||
conditions on a join would otherwise result in some.
|
conditions on a join would otherwise result in some.
|
||||||
|
|
||||||
Please note that for many databases, a sort on an associated table's columns will
|
Please note that for many databases, a sort on an associated table's columns will
|
||||||
result in invalid SQL with `:distinct => true` -- in those cases, you're on your own,
|
result in invalid SQL with `:distinct => true` -- in those cases, you're on your own,
|
||||||
and will need to modify the result as needed to allow these queries to work. Thankfully,
|
and will need to modify the result as needed to allow these queries to work. Thankfully,
|
||||||
|
@ -85,7 +85,7 @@ In your view:
|
||||||
|
|
||||||
`cont` (contains) and `start` (starts with) are just two of the available search predicates.
|
`cont` (contains) and `start` (starts with) are just two of the available search predicates.
|
||||||
See Constants for a full list.
|
See Constants for a full list.
|
||||||
|
|
||||||
### Advanced Mode
|
### Advanced Mode
|
||||||
|
|
||||||
"Advanced" searches (ab)use Rails' nested attributes functionality in order to generate
|
"Advanced" searches (ab)use Rails' nested attributes functionality in order to generate
|
||||||
|
@ -108,10 +108,10 @@ This means you'll need to tweak your routes...
|
||||||
index
|
index
|
||||||
render :index
|
render :index
|
||||||
end
|
end
|
||||||
|
|
||||||
... and update your `search_form_for` line in the view ...
|
... and update your `search_form_for` line in the view ...
|
||||||
|
|
||||||
<%= search_form_for @q, :url => search_people_path,
|
<%= search_form_for @q, :url => search_people_path,
|
||||||
:html => {:method => :post} do |f| %>
|
:html => {:method => :post} do |f| %>
|
||||||
|
|
||||||
Once you've done so, you can make use of the helpers in Ransack::Helpers::FormBuilder to
|
Once you've done so, you can make use of the helpers in Ransack::Helpers::FormBuilder to
|
||||||
|
@ -122,16 +122,13 @@ construct much more complex search forms, such as the one on the
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
If you'd like to support the continued development of Ransack, please consider
|
To support the project:
|
||||||
[making a donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=48Q9HY64L3TWA).
|
|
||||||
|
|
||||||
To support the project in other ways:
|
* Use Ransack in your apps, and let us know if you encounter anything that's broken or missing.
|
||||||
|
|
||||||
* Use Ransack in your apps, and let me know if you encounter anything that's broken or missing.
|
|
||||||
A failing spec is awesome. A pull request is even better!
|
A failing spec is awesome. A pull request is even better!
|
||||||
* Spread the word on Twitter, Facebook, and elsewhere if Ransack's been useful to you. The more
|
* Spread the word on Twitter, Facebook, and elsewhere if Ransack's been useful to you. The more
|
||||||
people who are using the project, the quicker we can find and fix bugs!
|
people who are using the project, the quicker we can find and fix bugs!
|
||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
Copyright © 2011 [Ernie Miller](http://twitter.com/erniemiller)
|
Copyright © 2011 [Ernie Miller](http://twitter.com/erniemiller)
|
||||||
|
|
|
@ -6,9 +6,9 @@ Gem::Specification.new do |s|
|
||||||
s.name = "ransack"
|
s.name = "ransack"
|
||||||
s.version = Ransack::VERSION
|
s.version = Ransack::VERSION
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.authors = ["Ernie Miller"]
|
s.authors = ["Ernie Miller", "Ryan Bigg"]
|
||||||
s.email = ["ernie@metautonomo.us"]
|
s.email = ["ernie@erniemiller.org", "radarlistener@gmail.com"]
|
||||||
s.homepage = "http://metautonomo.us/projects/ransack"
|
s.homepage = "http://erniemiller.org/projects/ransack"
|
||||||
s.summary = %q{Object-based searching for ActiveRecord (currently).}
|
s.summary = %q{Object-based searching for ActiveRecord (currently).}
|
||||||
s.description = %q{Ransack is the successor to the MetaSearch gem. It improves and expands upon MetaSearch's functionality, but does not have a 100%-compatible API.}
|
s.description = %q{Ransack is the successor to the MetaSearch gem. It improves and expands upon MetaSearch's functionality, but does not have a 100%-compatible API.}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue