db_reference 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README +28 -3
  2. data/Rakefile +1 -1
  3. metadata +3 -3
data/README CHANGED
@@ -1,13 +1,38 @@
1
1
  Reference
2
2
  =========
3
3
 
4
- Introduction goes here.
4
+ Used for creating a predefined set of models, similar to db:seed, but will not repopulate if entries already exist.
5
5
 
6
+ Place references in 'db/reference/'
7
+ References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.
8
+
9
+ Run with:
10
+ rake reference:load
6
11
 
7
12
  Example
8
13
  =======
9
14
 
10
- Example goes here.
15
+ The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'
16
+
17
+
18
+ # db/schema.rb
19
+ create_table "locations", :force => true do |t|
20
+ t.string "name", :null => false
21
+ end
22
+
23
+
24
+ # db/reference/000_locations.rb
25
+ Location.update_or_create :id => 1, :name => 'Wellington City'
26
+ Location.update_or_create :id => 2, :name => 'Lower Hutt'
27
+ Location.update_or_create :id => 3, :name => 'Kapiti Coast'
28
+ Location.update_or_create :id => 4, :name => 'Porirua'
29
+ Location.update_or_create :id => 5, :name => 'Upper Hutt'
30
+ Location.update_or_create :id => 6, :name => 'Wairarapa'
31
+
32
+
33
+
34
+
35
+
11
36
 
12
37
 
13
- Copyright (c) 2010 [name of plugin creator], released under the MIT license
38
+ Copyright (c) 2010 Able Technology, released under the MIT license
data/Rakefile CHANGED
@@ -35,7 +35,7 @@ PKG_FILES = FileList[
35
35
 
36
36
  spec = Gem::Specification.new do |s|
37
37
  s.name = "db_reference"
38
- s.version = "0.0.1"
38
+ s.version = "0.0.2"
39
39
  s.author = "Cam Fowler"
40
40
  s.email = "cameron.fowler@abletech.co.nz"
41
41
  s.homepage = "http://www.abletech.co.nz/"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_reference
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cam Fowler