pulitzer 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/interactions/pulitzer/create_free_form_section_partials.rb +2 -2
- data/app/interactions/pulitzer/post_types_controller/create_singleton_post.rb +1 -1
- data/app/interactions/pulitzer/post_types_controller/create_template_version.rb +1 -1
- data/app/models/pulitzer/partial.rb +4 -4
- data/app/models/pulitzer/partial_type.rb +1 -1
- data/app/models/pulitzer/post_type.rb +0 -6
- data/app/models/pulitzer/version.rb +2 -2
- data/app/views/pulitzer/partial_types/_new.html.erb +2 -2
- data/app/views/pulitzer/partial_types/_show.html.erb +1 -1
- data/db/migrate/20170515230633_create_post_type_version.rb +2 -2
- data/db/migrate/20170515232938_reconnect_post_type_to_post.rb +40 -1
- data/lib/pulitzer/version.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +4 -2
- data/spec/controllers/pulitzer/arrangement_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/background_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/free_form_section_types_controller_spec.rb +5 -4
- data/spec/controllers/pulitzer/justification_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/partials_controller_spec.rb +12 -10
- data/spec/controllers/pulitzer/post_type_content_element_types_controller_spec.rb +10 -9
- data/spec/controllers/pulitzer/post_types_controller_spec.rb +7 -4
- data/spec/controllers/pulitzer/sequence_flow_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/versions_controller_spec.rb +4 -3
- data/spec/dummy/app/controllers/pages_controller.rb +2 -1
- data/spec/dummy/config/application.rb +3 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +20 -12
- data/spec/dummy/db/seeds/pulitzer_post_types.rb +10 -6
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/state_machine/model.rb +23 -0
- data/spec/dummy/lib/state_machine/transition.rb +65 -0
- data/spec/dummy/log/development.log +275 -0
- data/spec/dummy/log/test.log +104454 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/199/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/199/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/199/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/221/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/221/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/221/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/243/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/243/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/243/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/265/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/265/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/265/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/287/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/287/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/287/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/309/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/309/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/309/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/331/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/331/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/331/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/353/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/353/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/353/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/375/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/375/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/375/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/397/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/397/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/397/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/419/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/419/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/419/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/441/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/441/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/441/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/463/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/463/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/463/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/485/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/485/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/485/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/507/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/507/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/507/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/529/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/529/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/529/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/551/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/551/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/551/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/595/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/595/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/595/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/617/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/617/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/617/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/639/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/639/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/639/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/661/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/661/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/661/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/683/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/683/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/683/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/705/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/705/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/705/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/727/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/727/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/727/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/749/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/749/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/749/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/771/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/771/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/771/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/793/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/793/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/793/thumb_sam_and_snow.jpg +0 -0
- data/spec/factories/free_form_section_types.rb +1 -1
- data/spec/factories/partial_type.rb +1 -1
- data/spec/factories/post.rb +1 -1
- data/spec/factories/post_type.rb +2 -12
- data/spec/factories/post_type_content_element_type.rb +1 -1
- data/spec/factories/post_type_version.rb +19 -0
- data/spec/interactions/clone_version_spec.rb +2 -1
- data/spec/interactions/create_free_form_section_partials_spec.rb +3 -3
- data/spec/interactions/create_partial_content_elements_spec.rb +4 -4
- data/spec/interactions/create_post_content_elements_spec.rb +4 -4
- data/spec/interactions/update_post_type_content_elements_spec.rb +3 -2
- data/spec/models/post_spec.rb +1 -1
- data/spec/models/post_type_content_element_type_spec.rb +4 -3
- data/spec/models/post_type_spec.rb +0 -6
- data/spec/models/version_spec.rb +2 -2
- metadata +184 -4
- data/spec/interactions/destroy_free_form_partials_spec.rb +0 -18
@@ -9,16 +9,19 @@ describe Pulitzer::PostTypesController do
|
|
9
9
|
post pulitzer.post_types_path post_type: { name: 'Flock of birds', kind: 'template', plural: '1' }
|
10
10
|
expect(response.status).to eq 200
|
11
11
|
expect(response.body).to match /Flock of birds/
|
12
|
-
|
12
|
+
post_type = Pulitzer::PostType.find_by(name: 'Flock of birds')
|
13
|
+
post_type_version = post_type.post_type_versions.first
|
14
|
+
expect(post_type_version.posts.any?).to be false
|
13
15
|
end
|
14
16
|
|
15
17
|
it "Creates a single post type with an intial post" do
|
16
18
|
post pulitzer.post_types_path post_type: { name: 'Crow', kind: 'template', plural: '0' }
|
17
19
|
post_type = Pulitzer::PostType.find_by(name: 'Crow')
|
20
|
+
post_type_version = post_type.post_type_versions.first
|
18
21
|
expect(response.status).to eq 200
|
19
|
-
expect(response.body).to match
|
20
|
-
expect(
|
21
|
-
expect(
|
22
|
+
expect(response.body).to match post_type_version.name
|
23
|
+
expect(post_type_version.posts.count).to eq 1
|
24
|
+
expect(post_type_version.posts.first.title).to eq post_type_version.name
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
@@ -5,11 +5,12 @@ describe Pulitzer::SequenceFlowStylesController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.create(name: 'partial with various layout styles', kind: Pulitzer::PostType.kinds[:partial], plural: false) }
|
8
|
-
let(:
|
8
|
+
let(:post_type_version) {post_type.post_type_versions.create}
|
9
|
+
let(:sequence_flow_style) { post_type_version.sequence_flow_styles.create(display_name: 'White', css_class_name: 'white') }
|
9
10
|
|
10
11
|
describe "sequence_flow_styles", type: :request do
|
11
12
|
it "renders the new form" do
|
12
|
-
get pulitzer.new_sequence_flow_style_path(sequence_flow_style: {
|
13
|
+
get pulitzer.new_sequence_flow_style_path(sequence_flow_style: {post_type_version_id: post_type_version.id})
|
13
14
|
expect(response.status).to eq 200
|
14
15
|
expect(response.body).to match /sequence_flow_style\[display_name\]/
|
15
16
|
end
|
@@ -17,7 +18,7 @@ describe Pulitzer::SequenceFlowStylesController do
|
|
17
18
|
it "creates a new sequence_flow_style" do
|
18
19
|
post pulitzer.sequence_flow_styles_path(
|
19
20
|
sequence_flow_style: {
|
20
|
-
|
21
|
+
post_type_version_id: post_type_version.id,
|
21
22
|
css_class_name: 'pretty-class',
|
22
23
|
display_name: 'Pretty Class'})
|
23
24
|
expect(response.status).to eq 200
|
@@ -5,8 +5,9 @@ describe Pulitzer::VersionsController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.named('Welcome') }
|
8
|
-
let(:
|
9
|
-
let(:
|
8
|
+
let(:post_type_version) {post_type.published_type_version}
|
9
|
+
let(:content_element_type) { post_type_version.post_type_content_element_types.first.content_element_type }
|
10
|
+
let(:ppost) { post_type_version.posts.first }
|
10
11
|
let(:version) {ppost.preview_version}
|
11
12
|
|
12
13
|
describe "updating versions", type: :request do
|
@@ -43,7 +44,7 @@ describe Pulitzer::VersionsController do
|
|
43
44
|
end
|
44
45
|
|
45
46
|
it "responds with errors if the interaction has one" do
|
46
|
-
ptcet =
|
47
|
+
ptcet = post_type_version.post_type_content_element_types.create(label: 'test', required: true, content_element_type: content_element_type)
|
47
48
|
version.content_elements.first.update_columns(body: nil, post_type_content_element_type_id: ptcet.id)
|
48
49
|
patch pulitzer.version_path id: version.id, status: 'active'
|
49
50
|
expect(response.status).to eq 409
|
@@ -10,7 +10,8 @@ class PagesController < ApplicationController
|
|
10
10
|
#Pulitzer Generated Actions
|
11
11
|
|
12
12
|
def welcome
|
13
|
-
|
13
|
+
post_type_version = Pulitzer::PostType.named('Welcome').published_type_version
|
14
|
+
@post = post_type_version.posts.find_by!(slug: params[:slug]).get_active_version!
|
14
15
|
end
|
15
16
|
|
16
17
|
end
|
Binary file
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -13,13 +13,13 @@
|
|
13
13
|
ActiveRecord::Schema.define(version: 20170602204900) do
|
14
14
|
|
15
15
|
create_table "pulitzer_arrangement_styles", force: :cascade do |t|
|
16
|
-
t.integer "
|
16
|
+
t.integer "post_type_version_id"
|
17
17
|
t.string "display_name"
|
18
18
|
t.string "view_file_name"
|
19
19
|
end
|
20
20
|
|
21
21
|
create_table "pulitzer_background_styles", force: :cascade do |t|
|
22
|
-
t.integer "
|
22
|
+
t.integer "post_type_version_id"
|
23
23
|
t.string "display_name"
|
24
24
|
t.string "css_class_name"
|
25
25
|
end
|
@@ -60,7 +60,7 @@ ActiveRecord::Schema.define(version: 20170602204900) do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
create_table "pulitzer_free_form_section_types", force: :cascade do |t|
|
63
|
-
t.integer "
|
63
|
+
t.integer "post_type_version_id"
|
64
64
|
t.string "name"
|
65
65
|
t.integer "sort_order"
|
66
66
|
end
|
@@ -72,7 +72,7 @@ ActiveRecord::Schema.define(version: 20170602204900) do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
create_table "pulitzer_justification_styles", force: :cascade do |t|
|
75
|
-
t.integer "
|
75
|
+
t.integer "post_type_version_id"
|
76
76
|
t.string "display_name"
|
77
77
|
t.string "css_class_name"
|
78
78
|
end
|
@@ -82,11 +82,11 @@ ActiveRecord::Schema.define(version: 20170602204900) do
|
|
82
82
|
t.string "label"
|
83
83
|
t.integer "sort_order"
|
84
84
|
t.integer "layout_id"
|
85
|
-
t.integer "
|
85
|
+
t.integer "post_type_version_id"
|
86
86
|
end
|
87
87
|
|
88
88
|
create_table "pulitzer_partials", force: :cascade do |t|
|
89
|
-
t.integer "
|
89
|
+
t.integer "post_type_version_id"
|
90
90
|
t.integer "free_form_section_id"
|
91
91
|
t.integer "sort_order"
|
92
92
|
t.integer "layout_id"
|
@@ -111,7 +111,7 @@ ActiveRecord::Schema.define(version: 20170602204900) do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
create_table "pulitzer_post_type_content_element_types", force: :cascade do |t|
|
114
|
-
t.integer "
|
114
|
+
t.integer "post_type_version_id"
|
115
115
|
t.integer "content_element_type_id"
|
116
116
|
t.string "label"
|
117
117
|
t.integer "height", default: 100
|
@@ -124,6 +124,13 @@ ActiveRecord::Schema.define(version: 20170602204900) do
|
|
124
124
|
t.string "clickable_kind", default: "any", null: false
|
125
125
|
end
|
126
126
|
|
127
|
+
create_table "pulitzer_post_type_versions", force: :cascade do |t|
|
128
|
+
t.integer "post_type_id"
|
129
|
+
t.integer "version_number", default: 1, null: false
|
130
|
+
t.string "status", default: "preview", null: false
|
131
|
+
t.index ["post_type_id"], name: "index_pulitzer_post_type_versions_on_post_type_id"
|
132
|
+
end
|
133
|
+
|
127
134
|
create_table "pulitzer_post_types", force: :cascade do |t|
|
128
135
|
t.string "name"
|
129
136
|
t.datetime "created_at", null: false
|
@@ -134,16 +141,17 @@ ActiveRecord::Schema.define(version: 20170602204900) do
|
|
134
141
|
|
135
142
|
create_table "pulitzer_posts", force: :cascade do |t|
|
136
143
|
t.string "title"
|
137
|
-
t.
|
138
|
-
t.
|
139
|
-
t.datetime "
|
140
|
-
t.datetime "updated_at", null: false
|
144
|
+
t.string "status", default: "unpublished"
|
145
|
+
t.datetime "created_at", null: false
|
146
|
+
t.datetime "updated_at", null: false
|
141
147
|
t.string "slug"
|
148
|
+
t.integer "post_type_version_id"
|
149
|
+
t.index ["post_type_version_id"], name: "index_pulitzer_posts_on_post_type_version_id"
|
142
150
|
t.index ["slug"], name: "index_pulitzer_posts_on_slug", unique: true
|
143
151
|
end
|
144
152
|
|
145
153
|
create_table "pulitzer_sequence_flow_styles", force: :cascade do |t|
|
146
|
-
t.integer "
|
154
|
+
t.integer "post_type_version_id"
|
147
155
|
t.string "display_name"
|
148
156
|
t.string "css_class_name"
|
149
157
|
end
|
@@ -2,6 +2,7 @@ module Seeds
|
|
2
2
|
module PulitzerPostTypes
|
3
3
|
def self.create
|
4
4
|
welcome_post_type = Pulitzer::PostType.create( name: "Welcome", plural: true, kind: :template)
|
5
|
+
post_type_version = welcome_post_type.post_type_versions.create(status: :published)
|
5
6
|
content_element_type = Pulitzer::ContentElementType.create(name: 'Text')
|
6
7
|
image_element_type = Pulitzer::ContentElementType.create(name: 'Image')
|
7
8
|
video_element_type = Pulitzer::ContentElementType.create(name: 'Video')
|
@@ -22,24 +23,27 @@ module Seeds
|
|
22
23
|
]
|
23
24
|
|
24
25
|
content_elements.each do |ce|
|
25
|
-
|
26
|
+
post_type_version.post_type_content_element_types.create ce
|
26
27
|
end
|
27
28
|
|
28
29
|
free_forms = [{name: "Main Content"}, {name: "Handpicked Homes"}]
|
29
|
-
free_forms.each{|ff|
|
30
|
+
free_forms.each{|ff| post_type_version.free_form_section_types.create(ff)}
|
30
31
|
|
31
|
-
welcome_post = Pulitzer::Post.create( title: "Welcome",
|
32
|
+
welcome_post = Pulitzer::Post.create( title: "Welcome", post_type_version: post_type_version )
|
32
33
|
|
33
34
|
Pulitzer::CreatePostContentElements.new(welcome_post).call
|
34
35
|
|
35
36
|
travel_guide_post_type = Pulitzer::PostType.create( name: "Travel Guides", plural: true, kind: :template)
|
36
|
-
|
37
|
+
tg_version = travel_guide_post_type.post_type_versions.create(status: :published)
|
38
|
+
travel_guide = tg_version.posts.create( title: 'Complete Guide to Breckenridge')
|
37
39
|
|
38
40
|
travel_article_post_type = Pulitzer::PostType.create( name: "Travel Articles", plural: true, kind: :template)
|
39
|
-
|
41
|
+
ta_version = travel_article_post_type.post_type_versions.create(status: :published)
|
42
|
+
travel_article = ta_version.posts.create( title: 'Ski Jump Competition')
|
40
43
|
|
41
44
|
external_article_post_type = Pulitzer::PostType.create( name: "External Articles", plural: true, kind: :template)
|
42
|
-
|
45
|
+
ea_version = external_article_post_type.post_type_versions.create(status: :published)
|
46
|
+
external_article = ea_version.posts.create( title: 'Why visit Breckenridge')
|
43
47
|
|
44
48
|
#publish the welcome post
|
45
49
|
welcome_post = Pulitzer::Post.find_by title: "Welcome"
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module StateMachine
|
2
|
+
module Model
|
3
|
+
|
4
|
+
def self.included(klass)
|
5
|
+
klass.extend ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
|
10
|
+
def register_transitions(service_hash)
|
11
|
+
service_hash.each do |service_name, service_class|
|
12
|
+
define_method("#{service_name}") {
|
13
|
+
service_class.new(self)
|
14
|
+
}
|
15
|
+
define_method("#{service_class.target_state}?") {
|
16
|
+
service_class.target_state.to_s == self.send(service_class.status_field)
|
17
|
+
}
|
18
|
+
delegate service_class.action_name, to: service_name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module StateMachine
|
2
|
+
module Transition
|
3
|
+
def self.included(klass)
|
4
|
+
klass.extend ActiveModel::Naming
|
5
|
+
klass.extend ClassMethods
|
6
|
+
klass.class_attribute :action_name, :target_state
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_accessor :errors, :object
|
10
|
+
|
11
|
+
delegate :action_name, :target_state, :valid_from_states, :status_field, to: :class
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
def status_field=(field_name)
|
15
|
+
@status_field = field_name
|
16
|
+
end
|
17
|
+
|
18
|
+
def status_field
|
19
|
+
return @status_field if @status_field
|
20
|
+
return 'status' if self.transitioning_class.column_names.include? 'status'
|
21
|
+
return 'state' if self.transitioning_class.column_names.include? 'state'
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid_from_states=(array)
|
25
|
+
if array.first.respond_to? :to_sym
|
26
|
+
@valid_from_states = array.map(&:to_sym)
|
27
|
+
else
|
28
|
+
@valid_from_states = array
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def valid_from_states
|
33
|
+
@valid_from_states
|
34
|
+
end
|
35
|
+
|
36
|
+
def transitioning_class
|
37
|
+
self.name.deconstantize.constantize
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_state
|
42
|
+
current_state = self.object.send status_field
|
43
|
+
current_state = current_state.to_sym if current_state.respond_to? :to_sym
|
44
|
+
current_state
|
45
|
+
end
|
46
|
+
|
47
|
+
def validate_transition
|
48
|
+
if self.valid_from_states.exclude? self.current_state
|
49
|
+
self.errors.add(:base, "You can't transition from #{self.current_state} to #{self.target_state}")
|
50
|
+
self.object.errors.add(:base, "You can't transition from #{self.current_state} to #{self.target_state}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def validate_transition!
|
55
|
+
if self.valid_from_states.exclude? self.current_state
|
56
|
+
raise "You can't transition from #{self.current_state} to #{self.target_state} for #{self.object.class.name} #{self.object.id}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_status
|
61
|
+
self.object.update status_field => self.target_state
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -1218,3 +1218,278 @@ Migrating to AddStyleToContentElement (20170602204900)
|
|
1218
1218
|
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", :environment], ["LIMIT", 1]]
|
1219
1219
|
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
1220
1220
|
[1m[35m (0.1ms)[0m [1m[36mcommit transaction[0m
|
1221
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1222
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1223
|
+
FROM sqlite_master
|
1224
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1225
|
+
UNION ALL
|
1226
|
+
SELECT sql
|
1227
|
+
FROM sqlite_temp_master
|
1228
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1229
|
+
[0m
|
1230
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1231
|
+
FROM sqlite_master
|
1232
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1233
|
+
UNION ALL
|
1234
|
+
SELECT sql
|
1235
|
+
FROM sqlite_temp_master
|
1236
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1237
|
+
[0m
|
1238
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1239
|
+
Migrating to CreatePostTypeVersion (20170515230633)
|
1240
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
1241
|
+
[1m[35m (0.6ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_versions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "pulitzer_post_type_id" integer, "version_number" integer DEFAULT 1 NOT NULL, "status" varchar DEFAULT 'preview' NOT NULL)[0m
|
1242
|
+
[1m[35m (0.1ms)[0m [1m[34mselect sqlite_version(*)[0m
|
1243
|
+
[1m[35m (0.1ms)[0m [1m[35mCREATE INDEX "index_pulitzer_post_type_versions_on_pulitzer_post_type_id" ON "pulitzer_post_type_versions" ("pulitzer_post_type_id")[0m
|
1244
|
+
[1m[35mSQL (0.5ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20170515230633"]]
|
1245
|
+
[1m[35m (0.8ms)[0m [1m[36mcommit transaction[0m
|
1246
|
+
Migrating to ReconnectPostTypeToPost (20170515232938)
|
1247
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
1248
|
+
[1m[35m (0.4ms)[0m [1m[35mALTER TABLE "pulitzer_posts" ADD "post_type_version_id" integer[0m
|
1249
|
+
[1m[36mPulitzer::PostType Load (0.2ms)[0m [1m[34mSELECT "pulitzer_post_types".* FROM "pulitzer_post_types"[0m
|
1250
|
+
[1m[35m (0.4ms)[0m [1m[35mCREATE TEMPORARY TABLE "apulitzer_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "post_type_id" integer, "status" varchar DEFAULT 'unpublished', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "slug" varchar, "post_type_version_id" integer)[0m
|
1251
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1252
|
+
FROM sqlite_master
|
1253
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1254
|
+
UNION ALL
|
1255
|
+
SELECT sql
|
1256
|
+
FROM sqlite_temp_master
|
1257
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1258
|
+
[0m
|
1259
|
+
[1m[35m (0.2ms)[0m [1m[35mCREATE UNIQUE INDEX "tindex_apulitzer_posts_on_slug" ON "apulitzer_posts" ("slug")[0m
|
1260
|
+
[1m[35m (0.3ms)[0m [1m[32mINSERT INTO "apulitzer_posts" ("id","title","post_type_id","status","created_at","updated_at","slug","post_type_version_id")
|
1261
|
+
SELECT "id","title","post_type_id","status","created_at","updated_at","slug","post_type_version_id" FROM "pulitzer_posts"[0m
|
1262
|
+
[1m[35m (0.4ms)[0m [1m[35mDROP TABLE "pulitzer_posts"[0m
|
1263
|
+
[1m[35m (0.1ms)[0m [1m[35mCREATE TABLE "pulitzer_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "status" varchar DEFAULT 'unpublished', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "slug" varchar, "post_type_version_id" integer)[0m
|
1264
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1265
|
+
FROM sqlite_master
|
1266
|
+
WHERE name='tindex_apulitzer_posts_on_slug' AND type='index'
|
1267
|
+
UNION ALL
|
1268
|
+
SELECT sql
|
1269
|
+
FROM sqlite_temp_master
|
1270
|
+
WHERE name='tindex_apulitzer_posts_on_slug' AND type='index'
|
1271
|
+
[0m
|
1272
|
+
[1m[35m (0.2ms)[0m [1m[35mCREATE UNIQUE INDEX "index_pulitzer_posts_on_slug" ON "pulitzer_posts" ("slug")[0m
|
1273
|
+
[1m[35m (0.2ms)[0m [1m[32mINSERT INTO "pulitzer_posts" ("id","title","status","created_at","updated_at","slug","post_type_version_id")
|
1274
|
+
SELECT "id","title","status","created_at","updated_at","slug","post_type_version_id" FROM "apulitzer_posts"[0m
|
1275
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE "apulitzer_posts"[0m
|
1276
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1277
|
+
FROM sqlite_master
|
1278
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1279
|
+
UNION ALL
|
1280
|
+
SELECT sql
|
1281
|
+
FROM sqlite_temp_master
|
1282
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1283
|
+
[0m
|
1284
|
+
[1m[35m (0.2ms)[0m [1m[35mCREATE INDEX "index_pulitzer_posts_on_post_type_version_id" ON "pulitzer_posts" ("post_type_version_id")[0m
|
1285
|
+
[1m[35mSQL (0.1ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20170515232938"]]
|
1286
|
+
[1m[35m (0.9ms)[0m [1m[36mcommit transaction[0m
|
1287
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", :environment], ["LIMIT", 1]]
|
1288
|
+
[1m[35m (0.4ms)[0m [1m[36mbegin transaction[0m
|
1289
|
+
[1m[35m (0.2ms)[0m [1m[36mcommit transaction[0m
|
1290
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1291
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1292
|
+
FROM sqlite_master
|
1293
|
+
WHERE name='index_pulitzer_post_type_versions_on_pulitzer_post_type_id' AND type='index'
|
1294
|
+
UNION ALL
|
1295
|
+
SELECT sql
|
1296
|
+
FROM sqlite_temp_master
|
1297
|
+
WHERE name='index_pulitzer_post_type_versions_on_pulitzer_post_type_id' AND type='index'
|
1298
|
+
[0m
|
1299
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1300
|
+
FROM sqlite_master
|
1301
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1302
|
+
UNION ALL
|
1303
|
+
SELECT sql
|
1304
|
+
FROM sqlite_temp_master
|
1305
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1306
|
+
[0m
|
1307
|
+
[1m[35m (0.2ms)[0m [1m[34m SELECT sql
|
1308
|
+
FROM sqlite_master
|
1309
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1310
|
+
UNION ALL
|
1311
|
+
SELECT sql
|
1312
|
+
FROM sqlite_temp_master
|
1313
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1314
|
+
[0m
|
1315
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1316
|
+
FROM sqlite_master
|
1317
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1318
|
+
UNION ALL
|
1319
|
+
SELECT sql
|
1320
|
+
FROM sqlite_temp_master
|
1321
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1322
|
+
[0m
|
1323
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1324
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1325
|
+
FROM sqlite_master
|
1326
|
+
WHERE name='index_pulitzer_post_type_versions_on_pulitzer_post_type_id' AND type='index'
|
1327
|
+
UNION ALL
|
1328
|
+
SELECT sql
|
1329
|
+
FROM sqlite_temp_master
|
1330
|
+
WHERE name='index_pulitzer_post_type_versions_on_pulitzer_post_type_id' AND type='index'
|
1331
|
+
[0m
|
1332
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1333
|
+
FROM sqlite_master
|
1334
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1335
|
+
UNION ALL
|
1336
|
+
SELECT sql
|
1337
|
+
FROM sqlite_temp_master
|
1338
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1339
|
+
[0m
|
1340
|
+
[1m[35m (0.2ms)[0m [1m[34m SELECT sql
|
1341
|
+
FROM sqlite_master
|
1342
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1343
|
+
UNION ALL
|
1344
|
+
SELECT sql
|
1345
|
+
FROM sqlite_temp_master
|
1346
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1347
|
+
[0m
|
1348
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1349
|
+
FROM sqlite_master
|
1350
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1351
|
+
UNION ALL
|
1352
|
+
SELECT sql
|
1353
|
+
FROM sqlite_temp_master
|
1354
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1355
|
+
[0m
|
1356
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1357
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1358
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1359
|
+
FROM sqlite_master
|
1360
|
+
WHERE name='index_pulitzer_post_type_versions_on_pulitzer_post_type_id' AND type='index'
|
1361
|
+
UNION ALL
|
1362
|
+
SELECT sql
|
1363
|
+
FROM sqlite_temp_master
|
1364
|
+
WHERE name='index_pulitzer_post_type_versions_on_pulitzer_post_type_id' AND type='index'
|
1365
|
+
[0m
|
1366
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1367
|
+
FROM sqlite_master
|
1368
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1369
|
+
UNION ALL
|
1370
|
+
SELECT sql
|
1371
|
+
FROM sqlite_temp_master
|
1372
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1373
|
+
[0m
|
1374
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1375
|
+
FROM sqlite_master
|
1376
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1377
|
+
UNION ALL
|
1378
|
+
SELECT sql
|
1379
|
+
FROM sqlite_temp_master
|
1380
|
+
WHERE name='index_pulitzer_posts_on_slug' AND type='index'
|
1381
|
+
[0m
|
1382
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1383
|
+
FROM sqlite_master
|
1384
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1385
|
+
UNION ALL
|
1386
|
+
SELECT sql
|
1387
|
+
FROM sqlite_temp_master
|
1388
|
+
WHERE name='index_pulitzer_tags_on_hierarchical' AND type='index'
|
1389
|
+
[0m
|
1390
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1391
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", :environment]]
|
1392
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1393
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", :environment]]
|
1394
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1395
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", :environment]]
|
1396
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_arrangement_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "view_file_name" varchar)[0m
|
1397
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_background_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1398
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_content_element_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
1399
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_content_elements" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "title" varchar, "body" text, "image" varchar, "version_id" integer, "post_type_content_element_type_id" integer, "content_element_type_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "text_editor" varchar, "height" integer DEFAULT 100, "width" integer DEFAULT 100, "sort_order" integer, "partial_id" integer, "style_id" integer, "custom_option_id" integer)[0m
|
1400
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE TABLE "pulitzer_custom_option_lists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar)[0m
|
1401
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_custom_options" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "custom_option_list_id" integer, "display" varchar, "value" varchar)[0m
|
1402
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_free_form_section_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "name" varchar, "sort_order" integer)[0m
|
1403
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_free_form_sections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "version_id" integer, "free_form_section_type_id" integer, "name" varchar)[0m
|
1404
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_justification_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1405
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_partial_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "free_form_section_type_id" integer, "label" varchar, "sort_order" integer, "layout_id" integer, "post_type_id" integer)[0m
|
1406
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_partials" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "free_form_section_id" integer, "sort_order" integer, "layout_id" integer, "label" varchar, "background_style_id" integer, "justification_style_id" integer, "sequence_flow_style_id" integer, "arrangement_style_id" integer)[0m
|
1407
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_post_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "version_id" integer, "label_id" integer, "label_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
1408
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_content_element_type_custom_option_lists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_content_element_type_id" integer, "custom_option_list_id" integer)[0m
|
1409
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_content_element_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "content_element_type_id" integer, "label" varchar, "height" integer DEFAULT 100, "width" integer DEFAULT 100, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "text_editor" varchar, "required" boolean DEFAULT 'f', "sort_order" integer, "clickable_kind" varchar DEFAULT 'any' NOT NULL)[0m
|
1410
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_versions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "version_number" integer DEFAULT 1 NOT NULL, "status" varchar DEFAULT 'preview' NOT NULL)[0m
|
1411
|
+
[1m[35m (0.1ms)[0m [1m[34mselect sqlite_version(*)[0m
|
1412
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE INDEX "index_pulitzer_post_type_versions_on_post_type_id" ON "pulitzer_post_type_versions" ("post_type_id")[0m
|
1413
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_post_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "plural" boolean, "kind" integer DEFAULT 0)[0m
|
1414
|
+
[1m[35m (1.7ms)[0m [1m[35mCREATE TABLE "pulitzer_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "status" varchar DEFAULT 'unpublished', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "slug" varchar, "post_type_version_id" integer)[0m
|
1415
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_pulitzer_posts_on_post_type_version_id" ON "pulitzer_posts" ("post_type_version_id")[0m
|
1416
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1417
|
+
FROM sqlite_master
|
1418
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1419
|
+
UNION ALL
|
1420
|
+
SELECT sql
|
1421
|
+
FROM sqlite_temp_master
|
1422
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1423
|
+
[0m
|
1424
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE UNIQUE INDEX "index_pulitzer_posts_on_slug" ON "pulitzer_posts" ("slug")[0m
|
1425
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_sequence_flow_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1426
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_content_element_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1427
|
+
[1m[35m (2.7ms)[0m [1m[35mCREATE TABLE "pulitzer_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "parent_id" integer, "hierarchical" boolean DEFAULT 'f' NOT NULL)[0m
|
1428
|
+
[1m[35m (1.9ms)[0m [1m[35mCREATE INDEX "index_pulitzer_tags_on_hierarchical" ON "pulitzer_tags" ("hierarchical")[0m
|
1429
|
+
[1m[35m (2.1ms)[0m [1m[35mCREATE TABLE "pulitzer_versions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "status" integer DEFAULT 0, "post_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "cloning_errors" text)[0m
|
1430
|
+
[1m[35m (2.4ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)[0m
|
1431
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT version FROM "schema_migrations"[0m
|
1432
|
+
[1m[35m (0.9ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES ('20170602204900')[0m
|
1433
|
+
[1m[35m (0.9ms)[0m [1m[32mINSERT INTO schema_migrations (version) VALUES
|
1434
|
+
('20170515230633'),
|
1435
|
+
('20170515232938');
|
1436
|
+
|
1437
|
+
[0m
|
1438
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
1439
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", :environment], ["LIMIT", 1]]
|
1440
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
1441
|
+
[1m[35mSQL (0.5ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m [["key", "environment"], ["value", "development"], ["created_at", 2017-06-07 00:28:00 UTC], ["updated_at", 2017-06-07 00:28:00 UTC]]
|
1442
|
+
[1m[35m (0.8ms)[0m [1m[36mcommit transaction[0m
|
1443
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", :environment], ["LIMIT", 1]]
|
1444
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
1445
|
+
[1m[35m (0.1ms)[0m [1m[36mcommit transaction[0m
|
1446
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_arrangement_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "view_file_name" varchar)[0m
|
1447
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_background_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1448
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_content_element_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
1449
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_content_elements" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "title" varchar, "body" text, "image" varchar, "version_id" integer, "post_type_content_element_type_id" integer, "content_element_type_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "text_editor" varchar, "height" integer DEFAULT 100, "width" integer DEFAULT 100, "sort_order" integer, "partial_id" integer, "style_id" integer, "custom_option_id" integer)[0m
|
1450
|
+
[1m[35m (2.1ms)[0m [1m[35mCREATE TABLE "pulitzer_custom_option_lists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar)[0m
|
1451
|
+
[1m[35m (1.8ms)[0m [1m[35mCREATE TABLE "pulitzer_custom_options" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "custom_option_list_id" integer, "display" varchar, "value" varchar)[0m
|
1452
|
+
[1m[35m (2.0ms)[0m [1m[35mCREATE TABLE "pulitzer_free_form_section_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "name" varchar, "sort_order" integer)[0m
|
1453
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_free_form_sections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "version_id" integer, "free_form_section_type_id" integer, "name" varchar)[0m
|
1454
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_justification_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1455
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_partial_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "free_form_section_type_id" integer, "label" varchar, "sort_order" integer, "layout_id" integer, "post_type_id" integer)[0m
|
1456
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_partials" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "free_form_section_id" integer, "sort_order" integer, "layout_id" integer, "label" varchar, "background_style_id" integer, "justification_style_id" integer, "sequence_flow_style_id" integer, "arrangement_style_id" integer)[0m
|
1457
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_post_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "version_id" integer, "label_id" integer, "label_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
1458
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_content_element_type_custom_option_lists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_content_element_type_id" integer, "custom_option_list_id" integer)[0m
|
1459
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_content_element_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "content_element_type_id" integer, "label" varchar, "height" integer DEFAULT 100, "width" integer DEFAULT 100, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "text_editor" varchar, "required" boolean DEFAULT 'f', "sort_order" integer, "clickable_kind" varchar DEFAULT 'any' NOT NULL)[0m
|
1460
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_post_type_versions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "version_number" integer DEFAULT 1 NOT NULL, "status" varchar DEFAULT 'preview' NOT NULL)[0m
|
1461
|
+
[1m[35m (0.1ms)[0m [1m[34mselect sqlite_version(*)[0m
|
1462
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_pulitzer_post_type_versions_on_post_type_id" ON "pulitzer_post_type_versions" ("post_type_id")[0m
|
1463
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_post_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "plural" boolean, "kind" integer DEFAULT 0)[0m
|
1464
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE TABLE "pulitzer_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "status" varchar DEFAULT 'unpublished', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "slug" varchar, "post_type_version_id" integer)[0m
|
1465
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE INDEX "index_pulitzer_posts_on_post_type_version_id" ON "pulitzer_posts" ("post_type_version_id")[0m
|
1466
|
+
[1m[35m (0.1ms)[0m [1m[34m SELECT sql
|
1467
|
+
FROM sqlite_master
|
1468
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1469
|
+
UNION ALL
|
1470
|
+
SELECT sql
|
1471
|
+
FROM sqlite_temp_master
|
1472
|
+
WHERE name='index_pulitzer_posts_on_post_type_version_id' AND type='index'
|
1473
|
+
[0m
|
1474
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE UNIQUE INDEX "index_pulitzer_posts_on_slug" ON "pulitzer_posts" ("slug")[0m
|
1475
|
+
[1m[35m (2.6ms)[0m [1m[35mCREATE TABLE "pulitzer_sequence_flow_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1476
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "pulitzer_styles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "post_type_content_element_type_id" integer, "display_name" varchar, "css_class_name" varchar)[0m
|
1477
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "parent_id" integer, "hierarchical" boolean DEFAULT 'f' NOT NULL)[0m
|
1478
|
+
[1m[35m (0.9ms)[0m [1m[35mCREATE INDEX "index_pulitzer_tags_on_hierarchical" ON "pulitzer_tags" ("hierarchical")[0m
|
1479
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "pulitzer_versions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "status" integer DEFAULT 0, "post_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "cloning_errors" text)[0m
|
1480
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)[0m
|
1481
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT version FROM "schema_migrations"[0m
|
1482
|
+
[1m[35m (2.8ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES ('20170602204900')[0m
|
1483
|
+
[1m[35m (1.0ms)[0m [1m[32mINSERT INTO schema_migrations (version) VALUES
|
1484
|
+
('20170515230633'),
|
1485
|
+
('20170515232938');
|
1486
|
+
|
1487
|
+
[0m
|
1488
|
+
[1m[35m (1.8ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
1489
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", :environment], ["LIMIT", 1]]
|
1490
|
+
[1m[35m (0.2ms)[0m [1m[36mbegin transaction[0m
|
1491
|
+
[1m[35mSQL (1.0ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m [["key", "environment"], ["value", "development"], ["created_at", 2017-06-07 00:28:00 UTC], ["updated_at", 2017-06-07 00:28:00 UTC]]
|
1492
|
+
[1m[35m (1.4ms)[0m [1m[36mcommit transaction[0m
|
1493
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", :environment], ["LIMIT", 1]]
|
1494
|
+
[1m[35m (0.0ms)[0m [1m[36mbegin transaction[0m
|
1495
|
+
[1m[35m (0.0ms)[0m [1m[36mcommit transaction[0m
|