-
Notifications
You must be signed in to change notification settings - Fork 29
Getting Started
wnadeau edited this page May 24, 2011
·
1 revision
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 Started
- Install gems
gem install appoxy-aws uuidtools appoxy-simple_record
- Create a model
`require 'simple_record'
class MyModel < SimpleRecord::Base has_attributes :name, :age are_ints :age end` More about ModelAttributes.
- 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
mm = MyModel.new mm.name = "Travis" mm.age = 32 mm.save id = mm.id
mm2 = MyModel.find(id) puts 'got=' + mm2.name + ' and he/she is ' + mm.age.to_s + ' years old'
mms = MyModel.find(:all, ["age=?", 32], :order=>"name", :limit=>10)