| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A feature-rich and powerful Ruby ORM for Amazon DynamoDB, designed to provide a familiar ActiveRecord-like experience for Ruby applications.
Add Dynamoid to your Gemfile:
gem 'dynamoid'Or install it using bundle:
bundle add dynamoidAlternatively, you can install the gem manually:
gem install dynamoidTo define a model, include Dynamoid::Document and declare your fields. Dynamoid supports ActiveModel validations and automatic timestamps:
class User
include Dynamoid::Document
field :name # Type defaults to :string
field :email
field :age, :integer
field :active, :boolean, default: true
validates :name, presence: true
validates :email, format: { with: /@/ }
endOnce defined, you can interact with your models using a familiar API:
# Create and Save
user = User.create(name: 'Josh', email: 'josh@example.com')
# Find and Update
user = User.where(email: 'josh@example.com').first
user.update_attributes(age: 30)
# Querying
users = User.where(active: true).all.to_aMinimal connection settings are required. You can configure Dynamoid in several ways, such as in config/initializers/dynamoid.rb (for Rails) or directly in your setup:
require 'dynamoid'
Dynamoid.configure do |config|
config.access_key = 'REPLACE_WITH_ACCESS_KEY_ID'
config.secret_key = 'REPLACE_WITH_SECRET_ACCESS_KEY'
config.region = 'REPLACE_WITH_REGION' # e.g. 'us-west-2'
endDynamoid relies on aws-sdk-dynamodb (AWS SDK v3) and activemodel (>= 4.2). It officially supports Ruby >= 2.3 and Rails >= 4.2.
Compatibility is tested against the following versions:
We welcome contributions to Dynamoid! Please see our CONTRIBUTING.md guide for details on how to get started. Join us!
See SECURITY.md.
The gem is available as open source under the terms of
the MIT License .
See LICENSE for the official Copyright Notice.
Dynamoid borrows code, structure, and even its name very liberally from the truly amazing Mongoid. Without Mongoid to crib from none of this would have been possible, and I hope they don't mind me reusing their very awesome ideas to make Amazon DynamoDB just as accessible to the Ruby world as MongoDB.
Also, without contributors the project wouldn't be nearly as awesome. So many thanks to:
* Current Maintainers
| Back | FazBrowse Home | New Git URL |