citrusbyte-schemer 0.0.6 → 0.0.7
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.
- data/README.markdown +13 -16
- data/rails/init.rb +2 -1
- data/test/schemer_test.rb +1 -0
- metadata +1 -1
data/README.markdown
CHANGED
@@ -13,7 +13,7 @@ care about keeping the data or how it's defined.
|
|
13
13
|
|
14
14
|
**WARNING:** This will create and delete data definitions on the fly with no
|
15
15
|
warning! Only use this with volatile data! Never attach it to an existing model
|
16
|
-
you care about as it will start adding and dropping columns without your
|
16
|
+
you care about as it will start adding and dropping columns without your
|
17
17
|
consent!
|
18
18
|
|
19
19
|
Usage
|
@@ -24,7 +24,7 @@ Usage
|
|
24
24
|
end
|
25
25
|
|
26
26
|
Creates a `users` table if it doesn't exist, complete with `username` and
|
27
|
-
`password` columns the first time
|
27
|
+
`password` columns the first time the User class is loaded.
|
28
28
|
|
29
29
|
Need another column to play with?
|
30
30
|
|
@@ -32,33 +32,30 @@ Need another column to play with?
|
|
32
32
|
schema :username, :password, :email
|
33
33
|
end
|
34
34
|
|
35
|
-
Adds an `email` column the next time `User
|
35
|
+
Adds an `email` column the next time `User` class is loaded.
|
36
36
|
|
37
|
-
|
37
|
+
Want a relationship? (but fear commitment...)
|
38
38
|
|
39
|
-
class
|
40
|
-
schema :
|
39
|
+
class Widget < ActiveRecord::Base
|
40
|
+
schema :user_id, :name
|
41
|
+
|
42
|
+
belongs_to :user
|
41
43
|
end
|
42
|
-
|
43
|
-
Removes the `username` column the next time `User.new` is called.
|
44
44
|
|
45
|
-
|
45
|
+
Works just fine, and you can drop it at any time!
|
46
46
|
|
47
47
|
class Widget < ActiveRecord::Base
|
48
|
-
schema :
|
49
|
-
|
50
|
-
belongs_to :user
|
48
|
+
schema :name
|
51
49
|
end
|
52
|
-
|
53
|
-
|
50
|
+
|
51
|
+
Removes the `user_id` column the next time the `Widget` class is loaded.
|
54
52
|
|
55
53
|
**NOTE:** All columns are created as string columns.
|
56
54
|
|
57
55
|
Installation
|
58
56
|
------------
|
59
57
|
|
60
|
-
$ gem
|
61
|
-
$ sudo gem install citrusbyte-schemer
|
58
|
+
$ sudo gem install citrusbyte-schemer --source=http://gems.github.com
|
62
59
|
|
63
60
|
License
|
64
61
|
-------
|
data/rails/init.rb
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
raise "We highly suggest you only use Schemer in development mode!" unless Rails.env.to_s
|
1
|
+
raise "We highly suggest you only use Schemer in development or test mode (not in #{Rails.env})!" unless %w( development test ).include?(Rails.env.to_s)
|
2
|
+
Rails.logger.warn "Loading Schemer which will consider all your data volatile!"
|
2
3
|
require 'schemer'
|
data/test/schemer_test.rb
CHANGED