README.md in gdatastore_mapper-0.1.3 vs README.md in gdatastore_mapper-0.1.4
- old
+ new
@@ -2,10 +2,11 @@
GdatastoreMapper is a mapper framework for Google Cloud Datastore in Ruby / Ruby on Rails.
Once you install GdatastoreMapper you can use Google Cloud Datastore like ActiveRecord.
## Table of Contents
+- [Demo](#demo)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Model Setting](#model-setting)
- [Persistence Methods](#persistence-methods)
@@ -13,28 +14,31 @@
- [Timestamp](#timestamp)
- [Associations](#associations)
- [One to Many](#one-to-many)
- [Development](#development)
-## Requirements
+## Demo
-GdatastoreMapper requires Rails version >= 4.2 (of course it's working for Rails 5)
+Here is [demo](https://gdatastore-mapper-sample.appspot.com/). The demo works with Google Cloud Datastore.
-google-cloud >= 0.27
+Source code is [here](https://github.com/shinyaK14/gdatastore_mapper/tree/master/rails_example).
+## Requirements
+GdatastoreMapper requires Rails version >= 5
+
+
## Installation
Execute rails new with --skip-active-record
```
$ rails new your_project --skip-active-record
```
Add this line to your application's Gemfile:
```ruby
-gem 'google-cloud'
gem 'gdatastore_mapper'
```
And then execute:
@@ -115,32 +119,32 @@
=> #<Book:0x00 @created_at=2017-04-07 10:03:54 +0200, @title="Harry Potter",
@id=12, @updated_at=2017-04-07 22:57:57 +0200>
```
```
Book.find_by(title: 'Harry Potter')
-=> #<Book:0x00 @created_at ....
+=> #<Book:0x00 @title="Harry Potter" ....
```
```
Book.order(title: :asc)
-=> [#<Book:0x00 @created_at .... ]
+=> [#<Book:0x00 @title="Harry Potter" .... ]
```
```
Book.first
-=> #<Book:0x00 @created_at ....
+=> #<Book:0x00 @title="Harry Potter" ....
```
```
Book.last
-=> #<Book:0x00 @created_at ....
+=> #<Book:0x00 @title="Harry Potter" ....
```
```
Book.count
=> 100
```
```
Book.all
-=> [#<Book:0x00 @created_at .... ]
+=> [#<Book:0x00 @title="Harry Potter" .... ]
```
## Timestamp
All records have created_at and updated_at. They will be updated automatically.
@@ -171,27 +175,27 @@
end
```
books.create
```
-rolling = Author.create(name: 'J K Rolling')
+rowling = Author.create(name: 'J. K. Rowling')
harry_poter = rolling.books.create(title: 'Harry Poter')
harry_poter2 = rolling.books.create(title: 'Harry Poter 2')
```
books
```
-rolling.books
-=> [#<Book:0x00 @created_at .... ]
+rowling.books
+=> [#<Book:0x00 @title="Harry Potter" .... ]
```
books.count
```
-rolling.books.count
+rowling.books.count
=> 2
```
```
harry_poter.author
-=> [#<Author:0x00 @created_at .... ]
+=> [#<Author:0x00 @name="J. K. Rowling" .... ]
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.