has_defaults 0.4.0 → 0.4.1
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/.gitignore +1 -1
- data/README.md +46 -0
- data/lib/has_defaults/active_record_ext.rb +18 -4
- data/lib/has_defaults/version.rb +1 -1
- data/spec/rails-2.3/Gemfile.lock +1 -1
- data/spec/rails-3.0/Gemfile.lock +1 -1
- data/spec/rails-3.2/Gemfile.lock +1 -1
- data/spec/shared/app_root/app/models/donut.rb +5 -0
- data/spec/shared/app_root/db/migrate/001_create_pastries.rb +1 -0
- data/spec/shared/has_defaults/active_record_ext_spec.rb +73 -52
- metadata +7 -9
- data/README +0 -74
- data/pkg/has_defaults-0.3.0.gem +0 -0
- data/spec/app_root/log/in_memory.log +0 -147
data/.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
.idea/*
|
2
|
-
|
2
|
+
pkg
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
has_defaults
|
2
|
+
============
|
3
|
+
|
4
|
+
Default values for ActiveRecord models.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
In your `Gemfile`
|
10
|
+
|
11
|
+
gem 'has_defaults'
|
12
|
+
|
13
|
+
Now run
|
14
|
+
|
15
|
+
bundle install
|
16
|
+
|
17
|
+
|
18
|
+
Usage
|
19
|
+
-----
|
20
|
+
|
21
|
+
Add the method call `has_defaults` to your model.
|
22
|
+
|
23
|
+
class Page < ActiveRecord::Base
|
24
|
+
has_defaults :title => "New page", :body => "Put your text here"
|
25
|
+
end
|
26
|
+
|
27
|
+
Attributes will be set only if it's a new record and the attribute is blank.
|
28
|
+
|
29
|
+
Retrieve the default attribute with the `default_for` instance method:
|
30
|
+
|
31
|
+
@page.default_for(:title)
|
32
|
+
|
33
|
+
You can pass Proc as attribute:
|
34
|
+
|
35
|
+
has_defaults :expires_at => proc { Time.now }
|
36
|
+
|
37
|
+
You can override the default attributes as follow:
|
38
|
+
|
39
|
+
Page.has_defaults_options = {:title => "Here's your new page", :body => "Write your page text"}
|
40
|
+
|
41
|
+
|
42
|
+
Maintainer
|
43
|
+
----------
|
44
|
+
|
45
|
+
* Original version by Nando Vieira (<http://simplesideias.com.br>)
|
46
|
+
* Patches in this fork by Henning Koch of makandra (<http://www.makandra.de/>)
|
@@ -8,14 +8,20 @@ module HasDefaults
|
|
8
8
|
|
9
9
|
include InstanceMethods
|
10
10
|
|
11
|
+
# Check if our parent class had default options, whose accessor we inherited.
|
12
|
+
# In this case we clone the default options as to not modify the options of our parent.
|
11
13
|
if respond_to?(:has_defaults_options)
|
12
14
|
self.has_defaults_options = has_defaults_options.dup
|
13
15
|
else
|
16
|
+
# Rails 3 and 2 have different copy-and-write accessor generators.
|
14
17
|
if respond_to?(:class_attribute)
|
15
18
|
class_attribute :has_defaults_options
|
16
19
|
else
|
17
20
|
class_inheritable_hash :has_defaults_options
|
18
21
|
end
|
22
|
+
# We only register the callback if we haven't registered it before,
|
23
|
+
# since in this branch we didn't inherit #has_defaults_options
|
24
|
+
after_initialize :set_default_attributes
|
19
25
|
end
|
20
26
|
|
21
27
|
self.has_defaults_options ||= {}
|
@@ -30,7 +36,6 @@ module HasDefaults
|
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
|
-
after_initialize :set_default_attributes
|
34
39
|
end
|
35
40
|
|
36
41
|
end
|
@@ -38,22 +43,31 @@ module HasDefaults
|
|
38
43
|
module InstanceMethods
|
39
44
|
|
40
45
|
def default_for(name)
|
41
|
-
self.class.has_defaults_options[name.to_sym]
|
46
|
+
raw_value = self.class.has_defaults_options[name.to_sym]
|
47
|
+
evaluate_raw_default_value(raw_value)
|
42
48
|
end
|
43
49
|
|
44
50
|
private
|
45
51
|
|
46
52
|
def set_default_attributes
|
47
53
|
if new_record?
|
48
|
-
self.class.has_defaults_options.each do |name,
|
54
|
+
self.class.has_defaults_options.each do |name, raw_value|
|
49
55
|
if send(name).nil?
|
50
|
-
value =
|
56
|
+
value = evaluate_raw_default_value(raw_value)
|
51
57
|
send("#{name}=", value)
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
63
|
+
def evaluate_raw_default_value(raw_value)
|
64
|
+
value = raw_value
|
65
|
+
if value.respond_to?(:call)
|
66
|
+
value = instance_eval(&value)
|
67
|
+
end
|
68
|
+
value
|
69
|
+
end
|
70
|
+
|
57
71
|
end
|
58
72
|
|
59
73
|
end
|
data/lib/has_defaults/version.rb
CHANGED
data/spec/rails-2.3/Gemfile.lock
CHANGED
data/spec/rails-3.0/Gemfile.lock
CHANGED
data/spec/rails-3.2/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ class Donut < Pastry
|
|
3
3
|
has_defaults :flavor => "cream", :name => "Cream"
|
4
4
|
has_defaults :maker => proc { "Dunkin Donuts" }
|
5
5
|
has_defaults :weight => proc { weigh }
|
6
|
+
has_defaults :health_benefits => proc { self.class.global_health_benefits }
|
6
7
|
|
7
8
|
def flavor
|
8
9
|
@flavor_getter_called = true
|
@@ -18,4 +19,8 @@ class Donut < Pastry
|
|
18
19
|
"a lot"
|
19
20
|
end
|
20
21
|
|
22
|
+
def self.global_health_benefits
|
23
|
+
'none'
|
24
|
+
end
|
25
|
+
|
21
26
|
end
|
@@ -4,71 +4,92 @@ describe HasDefaults::ActiveRecordExt do
|
|
4
4
|
|
5
5
|
context "given a model with defaults" do
|
6
6
|
|
7
|
-
|
8
|
-
new_donut = Donut.new
|
9
|
-
new_donut.flavor.should == "cream"
|
10
|
-
new_donut.name.should == "Cream"
|
11
|
-
end
|
7
|
+
describe 'initialization' do
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
it "should set defaults" do
|
10
|
+
new_donut = Donut.new
|
11
|
+
new_donut.flavor.should == "cream"
|
12
|
+
new_donut.name.should == "Cream"
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
it "should use setters methods to set the defaults" do
|
16
|
+
new_donut = Donut.new
|
17
|
+
new_donut.instance_variable_get('@flavor_setter_called').should be_true
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
20
|
+
it "should call procs in the model context when given as defaults" do
|
21
|
+
new_donut = Donut.new
|
22
|
+
new_donut.weight.should == 'a lot'
|
23
|
+
end
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
it "should merge multiple has_defaults directives" do
|
26
|
+
new_donut = Donut.new
|
27
|
+
new_donut.flavor.should == "cream"
|
28
|
+
new_donut.maker.should == "Dunkin Donuts"
|
29
|
+
end
|
33
30
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
it 'should not assign attributes multiple times when there are multiple has_defaults directives (bugfix)' do
|
32
|
+
Donut.should_receive(:global_health_benefits).once
|
33
|
+
Donut.new
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
it "should set defaults only if attributes are nil" do
|
37
|
+
donut = Donut.new(:flavor => 'vanilla')
|
38
|
+
donut.flavor.should == "vanilla"
|
39
|
+
end
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
it "should not set a default on an attribute that is set to an empty string" do
|
42
|
+
donut = Donut.new(:flavor => '')
|
43
|
+
donut.flavor.should == ''
|
44
|
+
end
|
47
45
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
it "should use getters methods to check if an attribute is nil" do
|
47
|
+
new_donut = Donut.new
|
48
|
+
new_donut.instance_variable_get('@flavor_getter_called').should be_true
|
49
|
+
end
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
it "should return default value for an attribute" do
|
52
|
+
Donut.new.default_for(:flavor).should == "cream"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should not set defaults when loading a saved record" do
|
56
|
+
Donut.create(:flavor => "vanilla")
|
57
|
+
Donut.first.flavor.should == "vanilla"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should define #after_initialize in Rails 2, but not Rails 3 (this method must be defined so after_initialize callbacks run)" do
|
61
|
+
donut = Donut.new
|
62
|
+
if Rails.version.to_i < 3
|
63
|
+
donut.should respond_to(:after_initialize)
|
64
|
+
else
|
65
|
+
donut.should_not respond_to(:after_initialize)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should not redefine defaults in its superclass" do
|
70
|
+
pastry = Pastry.new
|
71
|
+
pastry.maker.should == 'Mom'
|
72
|
+
pastry.default_for(:maker).should == 'Mom'
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should respect defaults from its superclass" do
|
76
|
+
donut = Donut.create
|
77
|
+
donut.main_ingredient.should == 'flour'
|
78
|
+
donut.maker.should_not == 'Mom'
|
59
79
|
end
|
60
|
-
end
|
61
80
|
|
62
|
-
it "should not redefine defaults in its superclass" do
|
63
|
-
pastry = Pastry.new
|
64
|
-
pastry.maker.should == 'Mom'
|
65
|
-
pastry.default_for(:maker).should == 'Mom'
|
66
81
|
end
|
67
82
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
83
|
+
describe '#default_for' do
|
84
|
+
|
85
|
+
it "should return the default value for the given attribute" do
|
86
|
+
Donut.new.default_for(:flavor).should == 'cream'
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should evaluate the default value if it is a lambda' do
|
90
|
+
Donut.new.default_for(:weight).should == 'a lot'
|
91
|
+
end
|
92
|
+
|
72
93
|
end
|
73
94
|
|
74
95
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_defaults
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 13
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Henning Koch
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-05-03 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -43,14 +43,12 @@ extra_rdoc_files: []
|
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
45
|
- MIT-LICENSE
|
46
|
-
- README
|
46
|
+
- README.md
|
47
47
|
- Rakefile
|
48
48
|
- has_defaults.gemspec
|
49
49
|
- lib/has_defaults.rb
|
50
50
|
- lib/has_defaults/active_record_ext.rb
|
51
51
|
- lib/has_defaults/version.rb
|
52
|
-
- pkg/has_defaults-0.3.0.gem
|
53
|
-
- spec/app_root/log/in_memory.log
|
54
52
|
- spec/rails-2.3/Gemfile
|
55
53
|
- spec/rails-2.3/Gemfile.lock
|
56
54
|
- spec/rails-2.3/Rakefile
|
@@ -149,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
147
|
requirements: []
|
150
148
|
|
151
149
|
rubyforge_project:
|
152
|
-
rubygems_version: 1.3.
|
150
|
+
rubygems_version: 1.3.9.5
|
153
151
|
signing_key:
|
154
152
|
specification_version: 3
|
155
153
|
summary: Default values for ActiveRecord models.
|
data/README
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
has_defaults
|
2
|
-
============
|
3
|
-
|
4
|
-
Default values for ActiveRecord models.
|
5
|
-
|
6
|
-
INSTALLATION
|
7
|
-
------------
|
8
|
-
|
9
|
-
In your `Gemfile`
|
10
|
-
|
11
|
-
gem 'has_defaults'
|
12
|
-
|
13
|
-
Now run
|
14
|
-
|
15
|
-
bundle install
|
16
|
-
|
17
|
-
|
18
|
-
USAGE
|
19
|
-
-----
|
20
|
-
|
21
|
-
Add the method call `has_defaults` to your model.
|
22
|
-
|
23
|
-
class Page < ActiveRecord::Base
|
24
|
-
has_defaults :title => "New page", :body => "Put your text here"
|
25
|
-
end
|
26
|
-
|
27
|
-
Attributes will be set only if it's a new record and the attribute is blank.
|
28
|
-
|
29
|
-
Retrieve the default attribute with the `default_for` instance method:
|
30
|
-
|
31
|
-
@page.default_for(:title)
|
32
|
-
|
33
|
-
You can pass Proc as attribute:
|
34
|
-
|
35
|
-
has_defaults :expires_at => proc { Time.now }
|
36
|
-
|
37
|
-
You can override the default attributes as follow:
|
38
|
-
|
39
|
-
Page.has_defaults_options = {:title => "Here's your new page", :body => "Write your page text"}
|
40
|
-
|
41
|
-
NOTE
|
42
|
-
----
|
43
|
-
|
44
|
-
Is **Ruby 1.9** ready!
|
45
|
-
|
46
|
-
MAINTAINER
|
47
|
-
----------
|
48
|
-
|
49
|
-
* Original version by Nando Vieira (<http://simplesideias.com.br>)
|
50
|
-
* Patches in this fork by Henning Koch (<http://www.makandra.de/>)
|
51
|
-
|
52
|
-
LICENSE:
|
53
|
-
--------
|
54
|
-
|
55
|
-
(The MIT License)
|
56
|
-
|
57
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
58
|
-
a copy of this software and associated documentation files (the
|
59
|
-
'Software'), to deal in the Software without restriction, including
|
60
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
61
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
62
|
-
permit persons to whom the Software is furnished to do so, subject to
|
63
|
-
the following conditions:
|
64
|
-
|
65
|
-
The above copyright notice and this permission notice shall be
|
66
|
-
included in all copies or substantial portions of the Software.
|
67
|
-
|
68
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
69
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
70
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
71
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
72
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
73
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
74
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/pkg/has_defaults-0.3.0.gem
DELETED
Binary file
|
@@ -1,147 +0,0 @@
|
|
1
|
-
# Logfile created on Mon Mar 22 10:14:11 +0100 2010 [4;36;1mSQL (0.5ms)[0m [0;1m SELECT name
|
2
|
-
FROM sqlite_master
|
3
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
4
|
-
[0m
|
5
|
-
[4;35;1mSQL (0.2ms)[0m [0mselect sqlite_version(*)[0m
|
6
|
-
[4;36;1mSQL (0.3ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
7
|
-
[4;35;1mSQL (0.2ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
8
|
-
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT name
|
9
|
-
FROM sqlite_master
|
10
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
11
|
-
[0m
|
12
|
-
[4;35;1mSQL (0.1ms)[0m [0mSELECT version FROM schema_migrations[0m
|
13
|
-
Migrating to CreatePastries (1)
|
14
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
15
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
16
|
-
Migrating to CreateModelWithoutDefaults (2)
|
17
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
18
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
19
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
20
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
21
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|
22
|
-
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT name
|
23
|
-
FROM sqlite_master
|
24
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
25
|
-
[0m
|
26
|
-
[4;35;1mSQL (0.2ms)[0m [0mselect sqlite_version(*)[0m
|
27
|
-
[4;36;1mSQL (0.3ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
28
|
-
[4;35;1mSQL (0.2ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
29
|
-
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT name
|
30
|
-
FROM sqlite_master
|
31
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
32
|
-
[0m
|
33
|
-
[4;35;1mSQL (0.1ms)[0m [0mSELECT version FROM schema_migrations[0m
|
34
|
-
Migrating to CreatePastries (1)
|
35
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
36
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
37
|
-
Migrating to CreateModelWithoutDefaults (2)
|
38
|
-
[4;36;1mSQL (0.1ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
39
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
40
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
41
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
42
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|
43
|
-
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT name
|
44
|
-
FROM sqlite_master
|
45
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
46
|
-
[0m
|
47
|
-
[4;35;1mSQL (0.2ms)[0m [0mselect sqlite_version(*)[0m
|
48
|
-
[4;36;1mSQL (0.3ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
49
|
-
[4;35;1mSQL (0.2ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
50
|
-
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT name
|
51
|
-
FROM sqlite_master
|
52
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
53
|
-
[0m
|
54
|
-
[4;35;1mSQL (0.1ms)[0m [0mSELECT version FROM schema_migrations[0m
|
55
|
-
Migrating to CreatePastries (1)
|
56
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
57
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
58
|
-
Migrating to CreateModelWithoutDefaults (2)
|
59
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
60
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
61
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
62
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
63
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|
64
|
-
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT name
|
65
|
-
FROM sqlite_master
|
66
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
67
|
-
[0m
|
68
|
-
[4;35;1mSQL (0.2ms)[0m [0mselect sqlite_version(*)[0m
|
69
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
70
|
-
[4;35;1mSQL (0.2ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
71
|
-
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT name
|
72
|
-
FROM sqlite_master
|
73
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
74
|
-
[0m
|
75
|
-
[4;35;1mSQL (0.1ms)[0m [0mSELECT version FROM schema_migrations[0m
|
76
|
-
Migrating to CreatePastries (1)
|
77
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
78
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
79
|
-
Migrating to CreateModelWithoutDefaults (2)
|
80
|
-
[4;36;1mSQL (0.1ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
81
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
82
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
83
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
84
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|
85
|
-
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT name
|
86
|
-
FROM sqlite_master
|
87
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
88
|
-
[0m
|
89
|
-
[4;35;1mSQL (0.7ms)[0m [0mselect sqlite_version(*)[0m
|
90
|
-
[4;36;1mSQL (0.8ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
91
|
-
[4;35;1mSQL (0.5ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
92
|
-
[4;36;1mSQL (0.6ms)[0m [0;1m SELECT name
|
93
|
-
FROM sqlite_master
|
94
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
95
|
-
[0m
|
96
|
-
[4;35;1mSQL (0.3ms)[0m [0mSELECT version FROM schema_migrations[0m
|
97
|
-
Migrating to CreatePastries (1)
|
98
|
-
[4;36;1mSQL (0.9ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
99
|
-
[4;35;1mSQL (0.3ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
100
|
-
Migrating to CreateModelWithoutDefaults (2)
|
101
|
-
[4;36;1mSQL (0.6ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
102
|
-
[4;35;1mSQL (0.3ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
103
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
104
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
105
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|
106
|
-
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT name
|
107
|
-
FROM sqlite_master
|
108
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
109
|
-
[0m
|
110
|
-
[4;35;1mSQL (0.2ms)[0m [0mselect sqlite_version(*)[0m
|
111
|
-
[4;36;1mSQL (0.3ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
112
|
-
[4;35;1mSQL (0.2ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
113
|
-
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT name
|
114
|
-
FROM sqlite_master
|
115
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
116
|
-
[0m
|
117
|
-
[4;35;1mSQL (0.1ms)[0m [0mSELECT version FROM schema_migrations[0m
|
118
|
-
Migrating to CreatePastries (1)
|
119
|
-
[4;36;1mSQL (0.3ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
120
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
121
|
-
Migrating to CreateModelWithoutDefaults (2)
|
122
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
123
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
124
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
125
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
126
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|
127
|
-
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT name
|
128
|
-
FROM sqlite_master
|
129
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
130
|
-
[0m
|
131
|
-
[4;35;1mSQL (0.2ms)[0m [0mselect sqlite_version(*)[0m
|
132
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
133
|
-
[4;35;1mSQL (0.2ms)[0m [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
134
|
-
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT name
|
135
|
-
FROM sqlite_master
|
136
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
137
|
-
[0m
|
138
|
-
[4;35;1mSQL (0.1ms)[0m [0mSELECT version FROM schema_migrations[0m
|
139
|
-
Migrating to CreatePastries (1)
|
140
|
-
[4;36;1mSQL (0.3ms)[0m [0;1mCREATE TABLE "pastries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "flavor" varchar(255), "name" varchar(255), "maker" varchar(255), "main_ingredient" varchar(255)) [0m
|
141
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
142
|
-
Migrating to CreateModelWithoutDefaults (2)
|
143
|
-
[4;36;1mSQL (0.2ms)[0m [0;1mCREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) [0m
|
144
|
-
[4;35;1mSQL (0.1ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('2')[0m
|
145
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')[0m
|
146
|
-
[4;35;1mDonut Load (0.3ms)[0m [0mSELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1[0m
|
147
|
-
[4;36;1mDonut Create (0.1ms)[0m [0;1mINSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')[0m
|