Riak の ruby用の ORM の ripple をRails 3.2系で使う。
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'ripple/railtie' | |
| # rails g ripple をして必要ファイルを生成すること | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Article | |
| include Ripple::Document | |
| property :title, String | |
| property :body, String, presence:true | |
| one :user | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | gem 'ripple', "~>1.0.0.beta2" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class User | |
| include Ripple::Document | |
| property :name, String | |
| property :login, String, presence:true | |
| index :login, String | |
| many :articles | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | > u = User.create(name:'CHU', login:'chu') | |
| => <User:o8fmcna88jctpxghshj7j5oncr9 login="chu" name="CHU"> | |
| > u.articles < < Article.create(title:"Hello world") | |
| => <Article:rsfkusim2keemw62kmtwjbjzo7n title="Hello world" body=nil> | |
| > u.save | |
| => true | |
| > User.find('7MtYxfhCObVSBqPX7DlEQYA5rtY') | |
| => <User:o8fmcna88jctpxghshj7j5oncr9 login="chu" name="CHU"> | |
| > User.find_by_index(:login, 'chu') | |
| => [<User:o8fmcna88jctpxghshj7j5oncr9 login="chu" name="CHU">] | 
