tb_blog 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -2
  3. data/app/assets/javascripts/admin/blog/posts.js +42 -0
  4. data/app/controllers/admin/post_categories_controller.rb +57 -57
  5. data/app/controllers/admin/posts_controller.rb +110 -101
  6. data/app/controllers/concerns/blog_url_helpers.rb +22 -18
  7. data/app/controllers/concerns/post_view_for_action.rb +11 -0
  8. data/app/controllers/posts_controller.rb +23 -34
  9. data/app/helpers/admin/posts_helper.rb +20 -20
  10. data/app/helpers/blog_helper.rb +21 -21
  11. data/app/models/spud/spud_post_model.rb +43 -51
  12. data/app/models/spud_blog_config.rb +2 -2
  13. data/app/models/spud_post.rb +1 -1
  14. data/app/models/spud_post_categories_post.rb +1 -1
  15. data/app/models/spud_post_category.rb +18 -20
  16. data/app/models/spud_post_site.rb +1 -1
  17. data/app/views/admin/posts/_form.html.erb +4 -3
  18. data/app/views/admin/posts/edit.html.erb +10 -2
  19. data/app/views/admin/posts/new.html.erb +9 -1
  20. data/app/views/admin/posts/show.html.erb +0 -0
  21. data/config/routes.rb +3 -1
  22. data/lib/generators/spud/blog/blog_generator.rb +5 -5
  23. data/lib/generators/spud/blog/random_posts_generator.rb +12 -14
  24. data/lib/generators/spud/blog/views_generator.rb +1 -1
  25. data/lib/spud_blog/configuration.rb +1 -2
  26. data/lib/spud_blog/engine.rb +12 -16
  27. data/lib/spud_blog/version.rb +3 -3
  28. data/lib/tasks/spud_blog_tasks.rake +1 -1
  29. data/lib/tb_blog.rb +2 -2
  30. data/spec/controllers/admin/posts_controller_spec.rb +28 -7
  31. data/spec/controllers/posts_controller_spec.rb +7 -7
  32. data/spec/dummy/config/application.rb +2 -3
  33. data/spec/dummy/config/boot.rb +1 -1
  34. data/spec/dummy/config/environment.rb +2 -2
  35. data/spec/dummy/config/environments/test.rb +3 -3
  36. data/spec/dummy/config/routes.rb +1 -1
  37. data/spec/dummy/config.ru +1 -1
  38. data/spec/dummy/db/migrate/{20120610130206_create_spud_admin_permissions.spud_core.rb → 20161020155425_create_spud_admin_permissions.tb_core.rb} +1 -1
  39. data/spec/dummy/db/migrate/20161020155426_create_spud_users.tb_core.rb +30 -0
  40. data/spec/dummy/db/migrate/{20120610130208_add_time_zone_to_spud_user.spud_core.rb → 20161020155427_add_time_zone_to_spud_user.tb_core.rb} +1 -2
  41. data/spec/dummy/db/migrate/{20120610130209_add_scope_to_spud_admin_permissions.spud_core.rb → 20161020155428_add_scope_to_spud_admin_permissions.tb_core.rb} +1 -2
  42. data/spec/dummy/db/migrate/{20120610130210_create_spud_user_settings.spud_core.rb → 20161020155429_create_spud_user_settings.tb_core.rb} +1 -1
  43. data/spec/dummy/db/migrate/{20140110180411_create_spud_roles.tb_core.rb → 20161020155430_create_spud_roles.tb_core.rb} +0 -0
  44. data/spec/dummy/db/migrate/{20140110180412_create_spud_permissions.tb_core.rb → 20161020155431_create_spud_permissions.tb_core.rb} +3 -3
  45. data/spec/dummy/db/migrate/{20140110180413_create_spud_role_permissions.tb_core.rb → 20161020155432_create_spud_role_permissions.tb_core.rb} +2 -2
  46. data/spec/dummy/db/migrate/{20140110180414_drop_spud_admin_permissions.tb_core.rb → 20161020155433_drop_spud_admin_permissions.tb_core.rb} +0 -0
  47. data/spec/dummy/db/migrate/{20160215174632_add_requires_password_change_to_spud_users.tb_core.rb → 20161020155434_add_requires_password_change_to_spud_users.tb_core.rb} +1 -1
  48. data/spec/dummy/db/migrate/{20160215174633_create_tb_redirects.tb_redirects.rb → 20161020155435_create_tb_redirects.tb_redirects.rb} +3 -3
  49. data/spec/dummy/db/migrate/{20140113162805_create_tb_liquid_spud_liquid_tags.tb_liquid.rb → 20161020155436_create_tb_liquid_spud_liquid_tags.tb_liquid.rb} +0 -0
  50. data/spec/dummy/db/migrate/{20140110180418_create_spud_posts.tb_blog.rb → 20161020155437_create_spud_posts.tb_blog.rb} +3 -3
  51. data/spec/dummy/db/migrate/{20140110180419_create_spud_post_categories.tb_blog.rb → 20161020155438_create_spud_post_categories.tb_blog.rb} +4 -4
  52. data/spec/dummy/db/migrate/{20140110180421_add_url_to_spud_posts.tb_blog.rb → 20161020155439_add_url_to_spud_posts.tb_blog.rb} +2 -2
  53. data/spec/dummy/db/migrate/20161020155440_add_url_to_spud_post_categories.tb_blog.rb +9 -0
  54. data/spec/dummy/db/migrate/{20140110180423_add_is_news_to_spud_posts.tb_blog.rb → 20161020155441_add_is_news_to_spud_posts.tb_blog.rb} +2 -2
  55. data/spec/dummy/db/migrate/{20140110180424_add_meta_to_posts.tb_blog.rb → 20161020155442_add_meta_to_posts.tb_blog.rb} +0 -0
  56. data/spec/dummy/db/migrate/{20140110180426_create_spud_post_sites.tb_blog.rb → 20161020155443_create_spud_post_sites.tb_blog.rb} +3 -3
  57. data/spec/dummy/db/migrate/{20140110180429_add_nested_set_to_post_categories.tb_blog.rb → 20161020155444_add_nested_set_to_post_categories.tb_blog.rb} +1 -5
  58. data/spec/dummy/db/migrate/{20140110180430_add_content_format_to_spud_posts.tb_blog.rb → 20161020155445_add_content_format_to_spud_posts.tb_blog.rb} +1 -1
  59. data/spec/dummy/db/migrate/{20140110180431_add_content_processed_to_spud_post.tb_blog.rb → 20161020155446_add_content_processed_to_spud_post.tb_blog.rb} +0 -0
  60. data/spec/dummy/db/migrate/{20140730131549_add_primary_key_to_spud_post_categories_posts.tb_blog.rb → 20161020155447_add_primary_key_to_spud_post_categories_posts.tb_blog.rb} +0 -0
  61. data/spec/dummy/db/migrate/{20140730131550_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb → 20161020155448_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb} +2 -1
  62. data/spec/dummy/db/migrate/{20140811161502_add_blog_key_to_spud_posts.tb_blog.rb → 20161020155449_add_blog_key_to_spud_posts.tb_blog.rb} +0 -0
  63. data/spec/dummy/db/migrate/{20150116195007_drop_spud_post_sites.tb_blog.rb → 20161020155450_drop_spud_post_sites.tb_blog.rb} +4 -3
  64. data/spec/dummy/db/migrate/{20151015154040_add_custom_author_to_post.tb_blog.rb → 20161020155451_add_custom_author_to_post.tb_blog.rb} +1 -1
  65. data/spec/dummy/db/migrate/{20160216150847_add_identifier_to_spud_posts.tb_blog.rb → 20161020155452_add_identifier_to_spud_posts.tb_blog.rb} +1 -1
  66. data/spec/dummy/db/schema.rb +106 -118
  67. data/spec/dummy/script/rails +2 -2
  68. data/spec/factories/spud_post_factories.rb +2 -2
  69. data/spec/helpers/admin/posts_helper_spec.rb +1 -1
  70. data/spec/models/spud_post_spec.rb +4 -4
  71. data/spec/rails_helper.rb +5 -5
  72. data/spec/spec_helper.rb +42 -44
  73. metadata +77 -79
  74. data/spec/dummy/db/migrate/20120610130207_create_spud_users.spud_core.rb +0 -30
  75. data/spec/dummy/db/migrate/20140110180415_create_spud_permalinks.tb_permalinks.rb +0 -12
  76. data/spec/dummy/db/migrate/20140110180416_add_site_id_to_spud_permalinks.tb_permalinks.rb +0 -7
  77. data/spec/dummy/db/migrate/20140110180417_modify_site_id_for_spud_permalinks.tb_permalinks.rb +0 -12
  78. data/spec/dummy/db/migrate/20140110180420_create_spud_post_comments.tb_blog.rb +0 -14
  79. data/spec/dummy/db/migrate/20140110180422_add_url_to_spud_post_categories.tb_blog.rb +0 -9
  80. data/spec/dummy/db/migrate/20140110180425_add_comments_counter_to_spud_posts.tb_blog.rb +0 -13
  81. data/spec/dummy/db/migrate/20140110180427_add_spam_fields_to_spud_post_comments.tb_blog.rb +0 -9
  82. data/spec/dummy/db/migrate/20140110180428_add_permalink_to_spud_post_comments.tb_blog.rb +0 -6
  83. data/spec/dummy/db/migrate/20140811161503_add_blog_key_to_spud_post_comments.tb_blog.rb +0 -7
  84. data/spec/dummy/db/migrate/20160216153113_drop_spud_post_comments.rb +0 -29
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::PostsController, :type => :controller do
3
+ describe Admin::PostsController, type: :controller do
4
4
 
5
5
  before(:each) do
6
6
  activate_session(admin: true)
@@ -12,16 +12,37 @@ describe Admin::PostsController, :type => :controller do
12
12
  end
13
13
 
14
14
  it 'should create a redirect' do
15
- expect{
16
- put :update, :id => @post.id, :spud_post => {:url_name => 'new-url'}, :blog_key => 'blog'
17
- }.to change(@post.tb_redirects, :count).by(1)
15
+ expect do
16
+ put :update, id: @post.id, spud_post: { url_name: 'new-url' }, blog_key: 'blog'
17
+ end.to change(@post.tb_redirects, :count).by(1)
18
18
  end
19
19
 
20
20
  it 'should not create a redirect' do
21
- expect{
22
- put :update, :id => @post.id, :spud_post => {:title => 'Hello World'}, :blog_key => 'blog'
23
- }.to_not change(@post.tb_redirects, :count)
21
+ expect do
22
+ put :update, id: @post.id, spud_post: { title: 'Hello World' }, blog_key: 'blog'
23
+ end.to_not change(@post.tb_redirects, :count)
24
24
  end
25
25
  end
26
26
 
27
+ describe '#preview' do
28
+ context 'with a new post' do
29
+ it 'should set the attributes without saving' do
30
+ expect do
31
+ post :preview, blog_key: 'blog', post_id: nil, spud_post: { title: 'Hello World' }
32
+ end.to_not change(SpudPost, :count)
33
+ end
34
+ end
35
+ context 'with an existing post' do
36
+ it 'should set the attributes without saving' do
37
+ @post = FactoryGirl.create(:spud_post)
38
+ expect do
39
+ post :preview,
40
+ blog_key: @post.blog_key,
41
+ post_id: @post.id,
42
+ spud_post: { title: 'Hello World' }
43
+ @post.reload
44
+ end.to_not change(@post, :title)
45
+ end
46
+ end
47
+ end
27
48
  end
@@ -1,27 +1,27 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe PostsController, :type => :controller do
3
+ describe PostsController, type: :controller do
4
4
 
5
5
  before(:each) do
6
6
  activate_authlogic
7
7
  end
8
8
 
9
9
  describe 'index' do
10
- it "should display a list of posts" do
11
- 2.times { |i| FactoryGirl.create(:spud_post) }
12
- get :index, {:blog_key => 'blog'}
10
+ it 'should display a list of posts' do
11
+ 2.times { |_i| FactoryGirl.create(:spud_post) }
12
+ get :index, blog_key: 'blog'
13
13
  expect(assigns(:posts).count).to be > 1
14
14
  end
15
15
 
16
- it "should not display any posts" do
17
- Spud::Blog.config.query_for_user = ->(user){
16
+ it 'should not display any posts' do
17
+ Spud::Blog.config.query_for_user = ->(user) {
18
18
  if user.blank?
19
19
  '1=0'
20
20
  else
21
21
  {}
22
22
  end
23
23
  }
24
- get :index, {:blog_key => 'blog'}
24
+ get :index, blog_key: 'blog'
25
25
  expect(assigns(:posts).count).to be 0
26
26
  Spud::Blog.config.query_for_user = nil
27
27
  end
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require
6
- require "tb_blog"
6
+ require 'tb_blog'
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
@@ -36,7 +36,7 @@ module Dummy
36
36
  config.i18n.enforce_available_locales = true
37
37
 
38
38
  # Configure the default encoding used in templates for Ruby 1.9.
39
- config.encoding = "utf-8"
39
+ config.encoding = 'utf-8'
40
40
 
41
41
  # Configure sensitive parameters which will be filtered from the log file.
42
42
  config.filter_parameters += [:password]
@@ -64,4 +64,3 @@ module Dummy
64
64
  config.assets.version = '1.0'
65
65
  end
66
66
  end
67
-
@@ -7,4 +7,4 @@ if File.exist?(gemfile)
7
7
  Bundler.setup
8
8
  end
9
9
 
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
10
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  Spud::Blog.configure do |config|
5
- config.news_enabled = true
6
- config.news_layout = 'application'
5
+ config.news_enabled = true
6
+ config.news_layout = 'application'
7
7
  end
8
8
 
9
9
  # Initialize the rails application
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # The test environment is used exclusively to run your application's
@@ -9,7 +9,7 @@ Dummy::Application.configure do
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
11
  config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
12
+ config.static_cache_control = 'public, max-age=3600'
13
13
 
14
14
  # Do not eager load code on boot. This avoids loading your whole application
15
15
  # just for the purpose of running a single test. If you are using a tool that
@@ -24,7 +24,7 @@ Dummy::Application.configure do
24
24
  config.action_dispatch.show_exceptions = false
25
25
 
26
26
  # Disable request forgery protection in test environment
27
- config.action_controller.allow_forgery_protection = false
27
+ config.action_controller.allow_forgery_protection = false
28
28
 
29
29
  # Tell Action Mailer not to deliver emails to the real world.
30
30
  # The :test delivery method accumulates sent emails in the
@@ -1,4 +1,4 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- root :to => "pages#show", :id => "home"
3
+ root to: 'pages#show', id: 'home'
4
4
  end
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Dummy::Application
@@ -1,4 +1,4 @@
1
- # This migration comes from spud_core (originally 20111214161011)
1
+ # This migration comes from tb_core (originally 20111214161011)
2
2
  class CreateSpudAdminPermissions < ActiveRecord::Migration
3
3
  def change
4
4
  create_table :spud_admin_permissions do |t|
@@ -0,0 +1,30 @@
1
+ # This migration comes from tb_core (originally 20111214161146)
2
+ class CreateSpudUsers < ActiveRecord::Migration
3
+ def change
4
+ create_table :spud_users do |t|
5
+
6
+ t.string :first_name
7
+ t.string :last_name
8
+ t.boolean :super_admin
9
+ t.string :login, null: false # optional, you can use email instead, or both
10
+ t.string :email, null: false # optional, you can use login instead, or both
11
+ t.string :crypted_password, null: false # optional, see below
12
+ t.string :password_salt, null: false # optional, but highly recommended
13
+ t.string :persistence_token, null: false # required
14
+ t.string :single_access_token, null: false # optional, see Authlogic::Session::Params
15
+ t.string :perishable_token, null: false # optional, see Authlogic::Session::Perishability
16
+
17
+ # Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
18
+ t.integer :login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
19
+ t.integer :failed_login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
20
+ t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
21
+ t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
22
+ t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
23
+ t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
24
+ t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
25
+ t.timestamps
26
+ end
27
+ add_index :spud_users, :login
28
+ add_index :spud_users, :email
29
+ end
30
+ end
@@ -1,7 +1,6 @@
1
- # This migration comes from spud_core (originally 20120327124229)
1
+ # This migration comes from tb_core (originally 20120327124229)
2
2
  class AddTimeZoneToSpudUser < ActiveRecord::Migration
3
3
  def change
4
4
  add_column :spud_users, :time_zone, :string
5
-
6
5
  end
7
6
  end
@@ -1,7 +1,6 @@
1
- # This migration comes from spud_core (originally 20120328235431)
1
+ # This migration comes from tb_core (originally 20120328235431)
2
2
  class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
3
3
  def change
4
4
  add_column :spud_admin_permissions, :scope, :string
5
-
6
5
  end
7
6
  end
@@ -1,4 +1,4 @@
1
- # This migration comes from spud_core (originally 20120329174000)
1
+ # This migration comes from tb_core (originally 20120329174000)
2
2
  class CreateSpudUserSettings < ActiveRecord::Migration
3
3
  def change
4
4
  create_table :spud_user_settings do |t|
@@ -2,10 +2,10 @@
2
2
  class CreateSpudPermissions < ActiveRecord::Migration
3
3
  def change
4
4
  create_table :spud_permissions do |t|
5
- t.string :name, :null => false
6
- t.string :tag, :null => false
5
+ t.string :name, null: false
6
+ t.string :tag, null: false
7
7
  t.timestamps
8
8
  end
9
- add_index :spud_permissions, :tag, :unique => true
9
+ add_index :spud_permissions, :tag, unique: true
10
10
  end
11
11
  end
@@ -2,8 +2,8 @@
2
2
  class CreateSpudRolePermissions < ActiveRecord::Migration
3
3
  def change
4
4
  create_table :spud_role_permissions do |t|
5
- t.integer :spud_role_id, :null => false
6
- t.string :spud_permission_tag, :null => false
5
+ t.integer :spud_role_id, null: false
6
+ t.string :spud_permission_tag, null: false
7
7
  t.timestamps
8
8
  end
9
9
  add_index :spud_role_permissions, :spud_role_id
@@ -1,6 +1,6 @@
1
1
  # This migration comes from tb_core (originally 20150610143438)
2
2
  class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration
3
3
  def change
4
- add_column :spud_users, :requires_password_change, :boolean, :default => false
4
+ add_column :spud_users, :requires_password_change, :boolean, default: false
5
5
  end
6
6
  end
@@ -4,12 +4,12 @@ class CreateTbRedirects < ActiveRecord::Migration
4
4
  create_table :tb_redirects do |t|
5
5
  t.string :owner_type
6
6
  t.integer :owner_id
7
- t.string :source, :null => false
8
- t.string :destination, :null => false
7
+ t.string :source, null: false
8
+ t.string :destination, null: false
9
9
  t.string :created_by
10
10
  t.timestamps null: false
11
11
  end
12
12
  add_index :tb_redirects, [:owner_type, :owner_id]
13
- add_index :tb_redirects, :source, :unique => true
13
+ add_index :tb_redirects, :source, unique: true
14
14
  end
15
15
  end
@@ -5,12 +5,12 @@ class CreateSpudPosts < ActiveRecord::Migration
5
5
  t.integer :spud_user_id
6
6
  t.string :title
7
7
  t.text :content
8
- t.boolean :comments_enabled, :default => false
9
- t.boolean :visible, :default => true
8
+ t.boolean :comments_enabled, default: false
9
+ t.boolean :visible, default: true
10
10
  t.datetime :published_at
11
11
  t.timestamps
12
12
  end
13
13
  add_index :spud_posts, :spud_user_id
14
14
  add_index :spud_posts, :visible
15
15
  end
16
- end
16
+ end
@@ -5,10 +5,10 @@ class CreateSpudPostCategories < ActiveRecord::Migration
5
5
  t.string :name
6
6
  t.timestamps
7
7
  end
8
- create_table :spud_post_categories_posts, :id => false do |t|
9
- t.integer :spud_post_id
10
- t.integer :spud_post_category_id
8
+ create_table :spud_post_categories_posts, id: false do |t|
9
+ t.integer :spud_post_id
10
+ t.integer :spud_post_category_id
11
11
  end
12
12
  add_index :spud_post_categories_posts, :spud_post_category_id
13
13
  end
14
- end
14
+ end
@@ -1,7 +1,7 @@
1
1
  # This migration comes from tb_blog (originally 20120127143054)
2
2
  class AddUrlToSpudPosts < ActiveRecord::Migration
3
3
  def change
4
- add_column :spud_posts, :url_name, :string
5
- add_index :spud_posts, :url_name
4
+ add_column :spud_posts, :url_name, :string
5
+ add_index :spud_posts, :url_name
6
6
  end
7
7
  end
@@ -0,0 +1,9 @@
1
+ # This migration comes from tb_blog (originally 20120127144942)
2
+ class AddUrlToSpudPostCategories < ActiveRecord::Migration
3
+ def change
4
+ add_column :spud_post_categories, :parent_id, :integer, default: 0
5
+ add_column :spud_post_categories, :url_name, :string
6
+ add_index :spud_post_categories, :parent_id
7
+ add_index :spud_post_categories, :url_name
8
+ end
9
+ end
@@ -1,7 +1,7 @@
1
1
  # This migration comes from tb_blog (originally 20120210165540)
2
2
  class AddIsNewsToSpudPosts < ActiveRecord::Migration
3
3
  def change
4
- add_column :spud_posts, :is_news, :boolean, :default => false
5
- add_index :spud_posts, :is_news
4
+ add_column :spud_posts, :is_news, :boolean, default: false
5
+ add_index :spud_posts, :is_news
6
6
  end
7
7
  end
@@ -2,11 +2,11 @@
2
2
  class CreateSpudPostSites < ActiveRecord::Migration
3
3
  def change
4
4
  create_table :spud_post_sites do |t|
5
- t.integer :spud_post_id, :null => false
6
- t.integer :spud_site_id, :null => false
5
+ t.integer :spud_post_id, null: false
6
+ t.integer :spud_site_id, null: false
7
7
  t.timestamps
8
8
  end
9
9
  add_index :spud_post_sites, :spud_post_id
10
- add_index :spud_post_sites, :spud_site_id
10
+ add_index :spud_post_sites, :spud_site_id
11
11
  end
12
12
  end
@@ -6,15 +6,11 @@ class AddNestedSetToPostCategories < ActiveRecord::Migration
6
6
  t.integer :rgt
7
7
  t.integer :depth
8
8
  end
9
-
10
- # Populates lft, rgt, and depth values for nested set
11
- #SpudPostCategory.where(:parent_id => 0).update_all({:parent_id => nil})
12
- #SpudPostCategory.rebuild!
13
9
  end
14
10
 
15
11
  def down
16
12
  change_table :spud_post_categories do |t|
17
- t.remove :ltf
13
+ t.remove :lft
18
14
  t.remove :rgt
19
15
  t.remove :depth
20
16
  end
@@ -1,6 +1,6 @@
1
1
  # This migration comes from tb_blog (originally 20130120151857)
2
2
  class AddContentFormatToSpudPosts < ActiveRecord::Migration
3
3
  def change
4
- add_column :spud_posts, :content_format, :string, :default => "HTML"
4
+ add_column :spud_posts, :content_format, :string, default: 'HTML'
5
5
  end
6
6
  end
@@ -5,12 +5,13 @@ class RemoveAwesomeNestedSetColumnsFromSpudPostCategories < ActiveRecord::Migrat
5
5
  t.remove :lft, :rgt, :depth, :parent_id
6
6
  end
7
7
  end
8
+
8
9
  def down
9
10
  change_table :spud_post_categories do |t|
10
11
  t.integer :lft
11
12
  t.integer :rgt
12
13
  t.integer :depth
13
- t.inreger :parent_id
14
+ t.integer :parent_id
14
15
  end
15
16
  end
16
17
  end
@@ -3,13 +3,14 @@ class DropSpudPostSites < ActiveRecord::Migration
3
3
  def up
4
4
  drop_table :spud_post_sites
5
5
  end
6
+
6
7
  def down
7
8
  create_table :spud_post_sites do |t|
8
- t.integer :spud_post_id, :null => false
9
- t.integer :spud_site_id, :null => false
9
+ t.integer :spud_post_id, null: false
10
+ t.integer :spud_site_id, null: false
10
11
  t.timestamps
11
12
  end
12
13
  add_index :spud_post_sites, :spud_post_id
13
- add_index :spud_post_sites, :spud_site_id
14
+ add_index :spud_post_sites, :spud_site_id
14
15
  end
15
16
  end
@@ -1,6 +1,6 @@
1
1
  # This migration comes from tb_blog (originally 20151015151133)
2
2
  class AddCustomAuthorToPost < ActiveRecord::Migration
3
3
  def change
4
- add_column :spud_posts, :custom_author, :string
4
+ add_column :spud_posts, :custom_author, :string
5
5
  end
6
6
  end
@@ -2,6 +2,6 @@
2
2
  class AddIdentifierToSpudPosts < ActiveRecord::Migration
3
3
  def change
4
4
  add_column :spud_posts, :identifier, :string
5
- add_index :spud_posts, :identifier, :unique => true
5
+ add_index :spud_posts, :identifier, unique: true
6
6
  end
7
7
  end