没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
oss.trustie.net/open_source_projects | 主页 > 开源项目社区 > simple-record |
simple-record
|
0 | 0 | 7 |
贡献者 | 讨论 | 代码提交 |
概述
NOTE: This project has moved to github along with the documentation: http://github.com/appoxy/simple_record
An ActiveRecord interface for SimpleDB that takes care of offsets and padding, etc. Can be used as a drop in replacement for ActiveRecord in rails.
Getting Started1. Install gems
gem install appoxy-aws uuidtools appoxy-simple_record 2. Create a model
require 'simple_record'
class MyModel < SimpleRecord::Base
has_attributes :name, :age
are_ints :age
endMore about ModelAttributes.
3. Setup environment
AWS_ACCESS_KEY_ID='XXXX'
AWS_SECRET_ACCESS_KEY='YYYY'
SimpleRecord.establish_connection(AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY)4. Go to town
- Store a model object to SimpleDB
mm = MyModel.new
mm.name = "Travis"
mm.age = 32
mm.save
id = mm.id
- Get an object from SimpleDB
mm2 = MyModel.find(id)
puts 'got=' + mm2.name + ' and he/she is ' + mm.age.to_s + ' years old'# Or more advanced queries mms = MyModel.find(:all, ["age=?", 32], :order=>"name", :limit=>10)
RepositoryWe're now using github for code repository: http://github.com/appoxy/simple_record
创建时间:2014-05-07 10:17