Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move setup step before build

The setup has to be done before the build, as it is building the engine
instances which are required for the mappers.
  • Loading branch information...
commit 16fe13acc36a8556fa1ea122b53978bfd125dbe6 1 parent ccde375
@Gibheer authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 README.md
View
18 README.md
@@ -81,6 +81,9 @@ end
# Create DM env
env = DataMapper::Environment.new
+# Setup db connection
+env.setup(:postgres, :uri => 'postgres://localhost/test')
+
# Define a mapper
env.build(User, :postgres) do
relation_name :users
@@ -89,9 +92,6 @@ env.build(User, :postgres) do
map :name, String, :to => :username
end
-# Setup db connection
-env.setup(:postgres, :uri => 'postgres://localhost/test')
-
# Finalize the environment
env.finalize
```
@@ -120,6 +120,9 @@ end
# Create DM env
env = DataMapper::Environment.new
+# Setup db connection
+env.setup(:postgres, :uri => 'postgres://localhost/test')
+
env.build(Order, :postgres) do
relation_name :orders
@@ -142,9 +145,6 @@ env.build(User, :postgres) do
end
end
-# Setup db connection
-env.setup(:postgres, :uri => 'postgres://localhost/test')
-
# Finalize the environment
env.finalize
@@ -181,6 +181,9 @@ end
# Create DM env
env = DataMapper::Environment.new
+# Setup db connection
+env.setup(:postgres, :uri => 'postgres://localhost/test')
+
env.build(Order, :postgres) do
key :id
end
@@ -193,9 +196,6 @@ env.build(User, :postgres) do
has 0..n, :orders, Order
end
-# Setup db connection
-env.setup(:postgres, :uri => 'postgres://localhost/test')
-
# Finalize the environment
env.finalize
Please sign in to comment.
Something went wrong with that request. Please try again.