has_defaults 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
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, value|
54
+ self.class.has_defaults_options.each do |name, raw_value|
49
55
  if send(name).nil?
50
- value = instance_eval(&value) if value.respond_to?(:call)
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
@@ -1,5 +1,5 @@
1
1
  module HasDefaults
2
2
 
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
 
5
5
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- has_defaults (0.3.1)
4
+ has_defaults (0.4.0)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- has_defaults (0.3.1)
4
+ has_defaults (0.4.0)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- has_defaults (0.3.1)
4
+ has_defaults (0.4.0)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -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
@@ -8,6 +8,7 @@ class CreatePastries < ActiveRecord::Migration
8
8
  t.string :maker
9
9
  t.string :weight
10
10
  t.string :main_ingredient
11
+ t.string :health_benefits
11
12
  end
12
13
  end
13
14
 
@@ -4,71 +4,92 @@ describe HasDefaults::ActiveRecordExt do
4
4
 
5
5
  context "given a model with defaults" do
6
6
 
7
- it "should set defaults" do
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
- it "should use setters methods to set the defaults" do
14
- new_donut = Donut.new
15
- new_donut.instance_variable_get('@flavor_setter_called').should be_true
16
- end
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
- it "should call procs in the model context when given as defaults" do
19
- new_donut = Donut.new
20
- new_donut.weight.should == 'a lot'
21
- end
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
- it "should merge multiple has_defaults directives" do
24
- new_donut = Donut.new
25
- new_donut.flavor.should == "cream"
26
- new_donut.maker.should == "Dunkin Donuts"
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
- it "should set defaults only if attributes are nil" do
30
- donut = Donut.new(:flavor => 'vanilla')
31
- donut.flavor.should == "vanilla"
32
- end
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
- it "should not set a default on an attribute that is set to an empty string" do
35
- donut = Donut.new(:flavor => '')
36
- donut.flavor.should == ''
37
- end
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
- it "should use getters methods to check if an attribute is nil" do
40
- new_donut = Donut.new
41
- new_donut.instance_variable_get('@flavor_getter_called').should be_true
42
- end
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
- it "should return default value for an attribute" do
45
- Donut.new.default_for(:flavor).should == "cream"
46
- end
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
- it "should not set defaults when loading a saved record" do
49
- Donut.create(:flavor => "vanilla")
50
- Donut.first.flavor.should == "vanilla"
51
- end
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
- it "should define #after_initialize in Rails 2, but not Rails 3 (this method must be defined so after_initialize callbacks run)" do
54
- donut = Donut.new
55
- if Rails.version.to_i < 3
56
- donut.should respond_to(:after_initialize)
57
- else
58
- donut.should_not respond_to(:after_initialize)
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
- it "should respect defaults from its superclass" do
69
- donut = Donut.create
70
- donut.main_ingredient.should == 'flour'
71
- donut.maker.should_not == 'Mom'
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: 15
5
- prerelease: false
4
+ hash: 13
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
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: 2012-06-29 00:00:00 +02:00
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.7
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.
Binary file
@@ -1,147 +0,0 @@
1
- # Logfile created on Mon Mar 22 10:14:11 +0100 2010 SQL (0.5ms)  SELECT name
2
- FROM sqlite_master
3
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
4
- 
5
- SQL (0.2ms) select sqlite_version(*)
6
- SQL (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
7
- SQL (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
8
- SQL (0.2ms)  SELECT name
9
- FROM sqlite_master
10
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
11
- 
12
- SQL (0.1ms) SELECT version FROM schema_migrations
13
- Migrating to CreatePastries (1)
14
- SQL (0.2ms) CREATE 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)) 
15
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
16
- Migrating to CreateModelWithoutDefaults (2)
17
- SQL (0.2ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
18
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('2')
19
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
20
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
21
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')
22
- SQL (0.3ms)  SELECT name
23
- FROM sqlite_master
24
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
25
- 
26
- SQL (0.2ms) select sqlite_version(*)
27
- SQL (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
28
- SQL (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
29
- SQL (0.2ms)  SELECT name
30
- FROM sqlite_master
31
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
32
- 
33
- SQL (0.1ms) SELECT version FROM schema_migrations
34
- Migrating to CreatePastries (1)
35
- SQL (0.2ms) CREATE 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)) 
36
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
37
- Migrating to CreateModelWithoutDefaults (2)
38
- SQL (0.1ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
39
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('2')
40
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
41
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
42
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')
43
- SQL (0.3ms)  SELECT name
44
- FROM sqlite_master
45
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
46
- 
47
- SQL (0.2ms) select sqlite_version(*)
48
- SQL (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
49
- SQL (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
50
- SQL (0.2ms)  SELECT name
51
- FROM sqlite_master
52
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
53
- 
54
- SQL (0.1ms) SELECT version FROM schema_migrations
55
- Migrating to CreatePastries (1)
56
- SQL (0.2ms) CREATE 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)) 
57
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
58
- Migrating to CreateModelWithoutDefaults (2)
59
- SQL (0.2ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
60
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('2')
61
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
62
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
63
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')
64
- SQL (0.3ms)  SELECT name
65
- FROM sqlite_master
66
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
67
- 
68
- SQL (0.2ms) select sqlite_version(*)
69
- SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
70
- SQL (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
71
- SQL (0.2ms)  SELECT name
72
- FROM sqlite_master
73
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
74
- 
75
- SQL (0.1ms) SELECT version FROM schema_migrations
76
- Migrating to CreatePastries (1)
77
- SQL (0.2ms) CREATE 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)) 
78
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
79
- Migrating to CreateModelWithoutDefaults (2)
80
- SQL (0.1ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
81
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('2')
82
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
83
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
84
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')
85
- SQL (0.3ms)  SELECT name
86
- FROM sqlite_master
87
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
88
- 
89
- SQL (0.7ms) select sqlite_version(*)
90
- SQL (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
91
- SQL (0.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
92
- SQL (0.6ms)  SELECT name
93
- FROM sqlite_master
94
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
95
- 
96
- SQL (0.3ms) SELECT version FROM schema_migrations
97
- Migrating to CreatePastries (1)
98
- SQL (0.9ms) CREATE 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)) 
99
- SQL (0.3ms) INSERT INTO schema_migrations (version) VALUES ('1')
100
- Migrating to CreateModelWithoutDefaults (2)
101
- SQL (0.6ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
102
- SQL (0.3ms) INSERT INTO schema_migrations (version) VALUES ('2')
103
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
104
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
105
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')
106
- SQL (0.3ms)  SELECT name
107
- FROM sqlite_master
108
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
109
- 
110
- SQL (0.2ms) select sqlite_version(*)
111
- SQL (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
112
- SQL (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
113
- SQL (0.2ms)  SELECT name
114
- FROM sqlite_master
115
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
116
- 
117
- SQL (0.1ms) SELECT version FROM schema_migrations
118
- Migrating to CreatePastries (1)
119
- SQL (0.3ms) CREATE 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)) 
120
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
121
- Migrating to CreateModelWithoutDefaults (2)
122
- SQL (0.2ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
123
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('2')
124
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
125
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
126
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')
127
- SQL (0.3ms)  SELECT name
128
- FROM sqlite_master
129
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
130
- 
131
- SQL (0.2ms) select sqlite_version(*)
132
- SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
133
- SQL (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
134
- SQL (0.2ms)  SELECT name
135
- FROM sqlite_master
136
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
137
- 
138
- SQL (0.1ms) SELECT version FROM schema_migrations
139
- Migrating to CreatePastries (1)
140
- SQL (0.3ms) CREATE 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)) 
141
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
142
- Migrating to CreateModelWithoutDefaults (2)
143
- SQL (0.2ms) CREATE TABLE "model_without_defaults" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
144
- SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('2')
145
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'vanilla')
146
- Donut Load (0.3ms) SELECT * FROM "pastries" WHERE ( ("pastries"."type" = 'Donut' ) ) LIMIT 1
147
- Donut Create (0.1ms) INSERT INTO "pastries" ("name", "main_ingredient", "type", "maker", "flavor") VALUES('Cream', 'flour', 'Donut', 'Dunkin Donuts', 'cream')