README.md in forty_facets-0.0.7 vs README.md in forty_facets-0.0.8
- old
+ new
@@ -40,12 +40,12 @@
If you have Movies with a textual title, categotized by genre, studio and year ..
class Movie < ActiveRecord::Base
belongs_to :year
- belongs_to :genre
belongs_to :studio
+ has_and_belongs_to_many :genres
end
You can then declare the structure of your search like so:
```ruby
@@ -53,13 +53,13 @@
class MovieSearch < FortyFacets::FacetSearch
model 'Movie' # which model to search for
text :title # filter by a generic string entered by the user
range :price, name: 'Price' # filter by ranges for decimal fields
- facet :genre, name: 'Genre' # generate a filter with all values of 'genre' occuring in the result
facet :year, name: 'Releaseyear', order: :year # additionally order values in the year field
facet :studio, name: 'Studio', order: :name
+ facet :genres, name: 'Genre' # generate a filter with all values of 'genre' occuring in the result
orders 'Title' => :title,
'price, cheap first' => "price asc",
'price, expensive first' => {price: :desc, title: :desc}
end
@@ -119,12 +119,12 @@
| range | | creates a range filter (param format 'FROM - TO') limiting result to entities with values in that range |
| orders | | takes a hash mapping a label to an argument that the active record `order` method can be called with to sort the result |
## FAQ
-### Can I create filter for `has_many` associations ?
+### What kind of associations can be searched/filtered for?
-No. At the moment only objects directly related via a `belongs_to` can be used as filter.
+At the moment you can facet for entities mapped via a standard `belongs_to` or `has_and_belongs_to` association.
## Contributing
1. Fork it ( http://github.com/fortytools/forty_facets/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)