README.md in nazrin-0.1.1 vs README.md in nazrin-0.2.0
- old
+ new
@@ -29,11 +29,11 @@
### in Ruby on Rails
```ruby
$ bundle exec rails g nazrin:config
-Nazrin.config do |config|
+Nazrin.configure do |config|
config.debug_mode = false
config.search_endpoint = ''
config.document_endpoint = ''
config.region = ''
config.access_key_id = ''
@@ -42,24 +42,25 @@
config.pagination = 'kaminari'
end
```
```ruby
-class Post
+class Post < ActiveRecord::Base
include Nazrin::ActiveRecord::Searchable
searchable do
fields [:content]
field(:created_at) { created_at.utc.iso8601 }
end
- after_create :update_in_index
+ after_create :add_to_index
+ after_update :update_in_index
after_destroy :delete_from_index
end
```
```ruby
-Post.search.size(1).start(0).query("(and 'content')").query_parser('structured').execute
+Post.search(where: :foo, includes: :bar).size(1).start(0).query("(and 'content')").query_parser('structured').execute
=> [#<Post id: 1, content: "content">]
```
## Development