README.md in fauna-0.2.5 vs README.md in fauna-0.2.6
- old
+ new
@@ -93,11 +93,11 @@
Fauna::Client.context($fauna) do
user = Fauna::User.create(unique_id: "taran77")
# fields
user.ref # => "users/123"
- user.ts # => 1359579766996758
+ user.ts # => 2013-01-30 13:02:46 -0800
user.deleted # => false
user.unique_id # => "taran77"
# data and references
user.data # => {}
@@ -118,15 +118,20 @@
```yaml
development:
email: taran@example.com
password: secret
+ publisher_key: secret_key
test:
email: taran@example.com
password: secret
```
+(In `config/fauna.yml`, if an existing publisher key is specified, the
+email and password can be omitted. If a publisher key is not
+specified, a new one will be created each time the app is started.)
+
Then, in `config/initializers/fauna.rb`:
```ruby
require "fauna/rails"
@@ -168,12 +173,12 @@
with Vision
end
```
-Install your schema on the server via a Rake task or the Rails
-console:
+Install your schema on the server via the `fauna:migrate` Rake task,
+or directly from the Rails console:
```ruby
Fauna::Client.context(Fauna.connection) do
Fauna.migrate_schema!
end
@@ -208,11 +213,11 @@
```ruby
# Create, find, update, and destroy Pigs.
Fauna::Client.context($fauna) do
@pig = Pig.create!(name: "Henwen", unique_id: "henwen")
- @pig = Pig.find(@pig.ref)
+ @pig = Pig.find(@pig.id)
@pig.update(title: "Oracular Swine")
@pig.title = "Most Illustrious Oracular Swine"
@pig.save!
@@ -230,10 +235,15 @@
Fauna::Client.context($fauna) do
@pig = Pig.create!(name: "Henwen", unique_id: "henwen")
@vision = Vision.create!(pronouncement: "In an ominous tower...")
@pig.visions.add @vision
- @pig.visions.page.events.first.resource # => @vision
+
+ page = @pig.visions.page(:size => 2)
+ page.events.first.resource # => @vision
+
+ next_page = @pig.visions.page(:size => 2, :before => page.before)
+ prev_page = @pig.visions.page(:size => 2, :after => page.after)
end
```
### References