DynamoDB Dynomite Associations Test Data
Important: These docs are for the outdated Jets 5 versions and below. For the latest Jets docs: docs.rubyonjets.com
Test data for explaining associations. Notably, friendly ids are set.
dynamodb/seeds.rb
9.times do |i|
n = i+1
Post.find_or_create_by!(id: "post-#{n}", category: "ruby", title: "post #{n}", body: "body #{n}")
nil
end
puts "posts created"
%w[tung bob kevin stuart].each do |name|
User.find_or_create_by!(id: name, name: name, email: "#{name}@example.com")
Profile.find_or_create_by!(id: name, bio: name)
end
puts "users created"
Migration Used to Create Table
class CreatePosts < Dynomite::Migration
def up
create_table :posts do |t|
t.partition_key :id
t.add_gsi :title
end
end
end