tb_redirects 0.9.0 → 1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/Rakefile +1 -5
  4. data/app/controllers/admin/tb_redirects_controller.rb +11 -14
  5. data/app/controllers/concerns/tb_redirects/handle_redirects.rb +3 -4
  6. data/app/helpers/admin/tb_redirects_helper.rb +2 -4
  7. data/app/jobs/tb_redirects/detect_redirect_loop_job.rb +5 -5
  8. data/app/models/concerns/tb_redirects/has_redirects.rb +1 -2
  9. data/app/models/tb_redirect.rb +12 -14
  10. data/lib/tb_redirects/engine.rb +5 -5
  11. data/lib/tb_redirects/version.rb +1 -1
  12. data/lib/tb_redirects.rb +1 -1
  13. data/spec/concerns/tb_redirects/has_redirects_spec.rb +6 -8
  14. data/spec/controllers/admin/tb_redirects_controller_spec.rb +13 -15
  15. data/spec/controllers/application_controller_spec.rb +3 -5
  16. data/spec/dummy/bin/setup +8 -8
  17. data/spec/dummy/config/application.rb +3 -7
  18. data/spec/dummy/config/environments/production.rb +1 -1
  19. data/spec/dummy/config/environments/test.rb +2 -2
  20. data/spec/dummy/db/migrate/20160211160615_create_spud_users.tb_core.rb +9 -10
  21. data/spec/dummy/db/migrate/20160211160616_add_time_zone_to_spud_user.tb_core.rb +0 -1
  22. data/spec/dummy/db/migrate/20160211160617_add_scope_to_spud_admin_permissions.tb_core.rb +0 -1
  23. data/spec/dummy/db/migrate/20160211160620_create_spud_permissions.tb_core.rb +3 -3
  24. data/spec/dummy/db/migrate/20160211160621_create_spud_role_permissions.tb_core.rb +2 -2
  25. data/spec/dummy/db/migrate/20160211160623_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
  26. data/spec/dummy/db/migrate/20160212211331_create_tb_redirects.tb_redirects.rb +3 -3
  27. data/spec/dummy/db/schema.rb +64 -66
  28. data/spec/factories/tb_redirects.rb +2 -2
  29. data/spec/helpers/admin/tb_redirects_helper_spec.rb +0 -2
  30. data/spec/jobs/tb_redirects/detect_redirect_loop_job_spec.rb +25 -27
  31. data/spec/models/tb_redirect_spec.rb +24 -27
  32. data/spec/rails_helper.rb +9 -3
  33. data/spec/spec_helper.rb +47 -49
  34. metadata +57 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c7b7541613a37b19550d1c27207402092d8cd73
4
- data.tar.gz: dbb3adba78aad74beacba8d516fc42cef9e39f52
3
+ metadata.gz: 256d8418f142449a8cb0c7ac7c02b4122271974d
4
+ data.tar.gz: b0d94c1d603913c9ff47d3ef5c1a7c7a9aa7959c
5
5
  SHA512:
6
- metadata.gz: 6269beeeeaf257f53defe0991b494a960c9a2f981550540a6841261049d74061f4722222c479782d5fd901a79e38d10c647110238a1798bb2ad875be59c6fb11
7
- data.tar.gz: e8574071c2d3136715a16cbb1f3b71c8a5c44843833a825453683c895a1576fba7ed37fc3a36c7cfa49e3d3d16cd757d7e5531cc5e760ea8f60f9089e6024a3d
6
+ metadata.gz: d233716c839aa5988d98d6d3b852384b904df2066640803ce0821d080a628fa78fb44be1f08ebaf01ca52a06385723eac6655dce03e61877f7238125cf48116d
7
+ data.tar.gz: 96b0ef3bc8528530ae026e8da1bf85c81e06e4307f650b010c7137dd707ab4474a84fec5e77e535524fef9d5dbb2e630a48695996543872852ac24e28eae0321
data/README.md CHANGED
@@ -4,7 +4,7 @@ TB Redirects is an engine for Twice Baked that provides basic redirection capabi
4
4
 
5
5
  ## Requirements
6
6
 
7
- We require Rails 4.2, tb_core 1.3, and ruby 2.2 or higher.
7
+ We require Rails 5, tb_core 1.4, and ruby 2.3.1 or higher.
8
8
 
9
9
  ## Installation
10
10
 
@@ -30,7 +30,7 @@ What this means for your controllers is that, in order for redirection to work p
30
30
 
31
31
  You can create a redirect in one of two ways. The first and easiest way is to create it through the Redirects admin module. Simply enter a `source` and `destination` and save it.
32
32
 
33
- The second way is through code. You can create a redirect using the `create_smart` method.
33
+ The second way is through code. You can create a redirect using the `create_smart` method.
34
34
 
35
35
  TbRedirect.create_smart({
36
36
  :source => '/my/path',
data/Rakefile CHANGED
@@ -14,14 +14,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
-
21
20
  load 'rails/tasks/statistics.rake'
22
21
 
23
-
24
-
25
22
  Bundler::GemHelper.install_tasks
26
23
 
27
24
  require 'rake/testtask'
@@ -33,5 +30,4 @@ Rake::TestTask.new(:test) do |t|
33
30
  t.verbose = false
34
31
  end
35
32
 
36
-
37
33
  task default: :test
@@ -1,14 +1,12 @@
1
1
  class Admin::TbRedirectsController < Admin::ApplicationController
2
2
 
3
3
  belongs_to_app :tb_redirects
4
- add_breadcrumb "Redirects", :admin_tb_redirects_path
5
- before_action :load_tb_redirect, :only => [:show, :edit, :update, :destroy]
4
+ add_breadcrumb 'Redirects', :admin_tb_redirects_path
5
+ before_action :load_tb_redirect, only: [:show, :edit, :update, :destroy]
6
6
 
7
7
  def index
8
- @tb_redirects = TbRedirect.ordered.paginate(:page => params[:page])
9
- if params[:search]
10
- @tb_redirects = @tb_redirects.search(params[:search])
11
- end
8
+ @tb_redirects = TbRedirect.ordered.paginate(page: params[:page])
9
+ @tb_redirects = @tb_redirects.search(params[:search]) if params[:search]
12
10
  respond_with @tb_redirects
13
11
  end
14
12
 
@@ -22,10 +20,9 @@ class Admin::TbRedirectsController < Admin::ApplicationController
22
20
  end
23
21
 
24
22
  def create
25
- if @tb_redirect = TbRedirect.create_smart(tb_redirect_params.merge(:created_by => 'user'))
26
- flash[:notice] = 'Redirect created successfully'
27
- end
28
- respond_with @tb_redirect, :location => admin_tb_redirects_path
23
+ @tb_redirect = TbRedirect.create_smart(tb_redirect_params.merge(created_by: 'user'))
24
+ flash[:notice] = 'Redirect created successfully' if @tb_redirect.errors.none?
25
+ respond_with @tb_redirect, location: admin_tb_redirects_path
29
26
  end
30
27
 
31
28
  def edit
@@ -36,18 +33,18 @@ class Admin::TbRedirectsController < Admin::ApplicationController
36
33
  if @tb_redirect.update_attributes(tb_redirect_params)
37
34
  flash[:notice] = 'Redirect updated successfully'
38
35
  end
39
- respond_with @tb_redirect, :location => admin_tb_redirects_path
36
+ respond_with @tb_redirect, location: admin_tb_redirects_path
40
37
  end
41
38
 
42
39
  def destroy
43
40
  flash[:notice] = 'Redirect deleted successfully' if @tb_redirect.destroy
44
- respond_with @tb_redirect, :location => admin_tb_redirects_path
41
+ respond_with @tb_redirect, location: admin_tb_redirects_path
45
42
  end
46
43
 
47
- private
44
+ private
48
45
 
49
46
  def load_tb_redirect
50
- @tb_redirect = TbRedirect.find_by!(:id => params[:id])
47
+ @tb_redirect = TbRedirect.find_by!(id: params[:id])
51
48
  end
52
49
 
53
50
  def tb_redirect_params
@@ -2,15 +2,14 @@ module TbRedirects::HandleRedirects
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- rescue_from Spud::NotFoundError, :with => :check_for_applicable_redirect
5
+ rescue_from Spud::NotFoundError, with: :check_for_applicable_redirect
6
6
  end
7
7
 
8
8
  def check_for_applicable_redirect(error)
9
- if redirect = TbRedirect.find_by_uri(request.original_url)
10
- redirect_to redirect.destination, :status => :moved_permanently
9
+ if redirect = TbRedirect.find_with_uri(request.original_url)
10
+ redirect_to redirect.destination, status: :moved_permanently
11
11
  else
12
12
  handle_request_error(error)
13
13
  end
14
14
  end
15
-
16
15
  end
@@ -1,11 +1,9 @@
1
1
  module Admin::TbRedirectsHelper
2
-
3
2
  def created_by_for_tb_redirect(created_by)
4
3
  if created_by == 'user'
5
- content_tag :span, created_by.titleize, :class => 'label label-info'
4
+ content_tag :span, created_by.titleize, class: 'label label-info'
6
5
  else
7
- content_tag :span, created_by.titleize, :class => 'label label-default'
6
+ content_tag :span, created_by.titleize, class: 'label label-default'
8
7
  end
9
8
  end
10
-
11
9
  end
@@ -10,11 +10,11 @@ class TbRedirects::DetectRedirectLoopJob < ActiveJob::Base
10
10
  end
11
11
 
12
12
  def perform(redirect)
13
- parents = TbRedirect.where(:destination => redirect.source)
14
- parents.each{ |p| search_parent(p, redirect.destination) }
13
+ parents = TbRedirect.where(destination: redirect.source)
14
+ parents.each { |p| search_parent(p, redirect.destination) }
15
15
  end
16
16
 
17
- private
17
+ private
18
18
 
19
19
  class AttemptsExceeded < StandardError
20
20
  end
@@ -26,8 +26,8 @@ private
26
26
  if parent.source == destination_to_check
27
27
  parent.destroy
28
28
  else
29
- parents = TbRedirect.where(:destination => parent.source)
30
- parents.each{ |p| search_parent(p, destination_to_check) }
29
+ parents = TbRedirect.where(destination: parent.source)
30
+ parents.each { |p| search_parent(p, destination_to_check) }
31
31
  end
32
32
  end
33
33
 
@@ -2,7 +2,6 @@ module TbRedirects::HasRedirects
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- has_many :tb_redirects, :dependent => :destroy, :as => :owner
5
+ has_many :tb_redirects, dependent: :destroy, as: :owner
6
6
  end
7
-
8
7
  end
@@ -1,17 +1,17 @@
1
1
  class TbRedirect < ActiveRecord::Base
2
- scope :ordered, ->{ order('source desc') }
3
- scope :search, ->(term){ where('source LIKE ?', "%#{term}%") }
2
+ scope :ordered, -> { order('source desc') }
3
+ scope :search, ->(term) { where('source LIKE ?', "%#{term}%") }
4
4
 
5
- belongs_to :owner, :polymorphic => true, :inverse_of => :tb_redirects
5
+ belongs_to :owner, polymorphic: true, inverse_of: :tb_redirects
6
6
 
7
- validates :source, :destination, :created_by, :presence => true
8
- validates :source, :uniqueness => true
7
+ validates :source, :destination, :created_by, presence: true
8
+ validates :source, uniqueness: true
9
9
 
10
10
  validate :source_not_equals_destination
11
11
  after_save :destroy_opposite_redirect
12
12
  after_save :schedule_loop_detection
13
13
 
14
- def self.find_by_uri(uri)
14
+ def self.find_with_uri(uri)
15
15
  path = URI(uri).path
16
16
  uri_without_params = uri.split('?').first
17
17
  find_by(
@@ -24,32 +24,30 @@ class TbRedirect < ActiveRecord::Base
24
24
  end
25
25
 
26
26
  def self.create_smart(params)
27
- redirect = find_or_initialize_by(:source => params.delete(:source))
27
+ redirect = find_or_initialize_by(source: params.delete(:source))
28
28
  redirect.assign_attributes(params)
29
29
  redirect.save()
30
30
  return redirect
31
31
  end
32
32
 
33
- private
33
+ private
34
34
 
35
35
  def source_not_equals_destination
36
- if self.source == self.destination
36
+ if source == destination
37
37
  errors.add(:destination, 'cannot be the same as the source')
38
38
  end
39
39
  return true
40
40
  end
41
41
 
42
42
  def destroy_opposite_redirect
43
- opposite = TbRedirect.find_by({
44
- :source => self.destination,
45
- :destination => self.source
46
- })
43
+ opposite = TbRedirect.find_by(source: destination,
44
+ destination: source)
47
45
  opposite.destroy if opposite.present?
48
46
  return true
49
47
  end
50
48
 
51
49
  def schedule_loop_detection
52
- if TbRedirect.where(:destination => source).count > 0
50
+ if TbRedirect.where(destination: source).count > 0
53
51
  TbRedirects::DetectRedirectLoopJob.perform_later(self)
54
52
  end
55
53
  return true
@@ -6,19 +6,19 @@ module TbRedirects
6
6
  config.autoload_paths += Dir["#{config.root}/lib/**/"]
7
7
 
8
8
  config.generators do |g|
9
- g.test_framework :rspec, :fixture => false
10
- g.fixture_replacement :factory_girl, :dir => 'spec/factories'
9
+ g.test_framework :rspec, fixture: false
10
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
11
11
  g.assets false
12
12
  g.helper true
13
13
  end
14
14
 
15
- initializer 'tb_redirects.admin', :before => 'tb_core.admin' do |config|
15
+ initializer 'tb_redirects.admin', before: 'tb_core.admin' do |_config|
16
16
  Spud::Core.admin_applications += [
17
- {:name => 'Redirects', :key => :tb_redirects, :thumbnail => "admin/module_icon.png", :url => '/admin/redirects'},
17
+ { name: 'Redirects', key: :tb_redirects, thumbnail: 'admin/module_icon.png', url: '/admin/redirects' }
18
18
  ]
19
19
  end
20
20
 
21
- initializer 'tb_redirects.controllers' do |config|
21
+ initializer 'tb_redirects.controllers' do |_config|
22
22
  ActiveSupport.on_load(:action_controller) do
23
23
  Spud::ApplicationController.send :include, TbRedirects::HandleRedirects
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module TbRedirects
2
- VERSION = "0.9.0"
2
+ VERSION = '1.0.beta1'.freeze
3
3
  end
data/lib/tb_redirects.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "tb_redirects/engine"
1
+ require 'tb_redirects/engine'
2
2
 
3
3
  module TbRedirects
4
4
  end
@@ -1,22 +1,20 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe TbRedirects::HasRedirects do
4
-
5
4
  describe 'included' do
6
5
  it 'should add a has_many relationship' do
7
- widget = Widget.create(:name => 'Test')
8
- redirect = widget.tb_redirects.create(:source => 'a', :destination => 'b')
6
+ widget = Widget.create(name: 'Test')
7
+ redirect = widget.tb_redirects.create(source: 'a', destination: 'b')
9
8
  expect(widget.tb_redirects).to eq([redirect])
10
9
  end
11
10
 
12
11
  it 'should delete the related redirects' do
13
- widget = Widget.create(:name => 'Test')
14
- redirect = widget.tb_redirects.create(:source => 'a', :destination => 'b')
12
+ widget = Widget.create(name: 'Test')
13
+ redirect = widget.tb_redirects.create(source: 'a', destination: 'b')
15
14
  widget.destroy
16
- expect{
15
+ expect do
17
16
  TbRedirect.find(redirect.id)
18
- }.to raise_error(ActiveRecord::RecordNotFound)
17
+ end.to raise_error(ActiveRecord::RecordNotFound)
19
18
  end
20
19
  end
21
-
22
20
  end
@@ -1,7 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- RSpec.describe Admin::TbRedirectsController, :type => :controller do
4
-
3
+ RSpec.describe Admin::TbRedirectsController, type: :controller do
5
4
  before(:each) do
6
5
  activate_session(admin: true)
7
6
  end
@@ -17,13 +16,13 @@ RSpec.describe Admin::TbRedirectsController, :type => :controller do
17
16
  describe 'show' do
18
17
  it 'should render the show page' do
19
18
  tb_redirect = FactoryGirl.create(:tb_redirect)
20
- get :show, :id => tb_redirect.id
19
+ get :show, params: { id: tb_redirect.id }
21
20
  expect(response).to have_http_status :success
22
21
  expect(response).to render_template :show
23
22
  end
24
23
 
25
24
  it 'should return a 404 error' do
26
- get :show, :id => 1
25
+ get :show, params: { id: 1 }
27
26
  expect(response).to have_http_status :not_found
28
27
  end
29
28
  end
@@ -39,7 +38,7 @@ RSpec.describe Admin::TbRedirectsController, :type => :controller do
39
38
  describe 'edit' do
40
39
  it 'should render the edit page' do
41
40
  tb_redirect = FactoryGirl.create(:tb_redirect)
42
- get :edit, :id => tb_redirect.id
41
+ get :edit, params: { id: tb_redirect.id }
43
42
  expect(response).to have_http_status :success
44
43
  expect(response).to render_template :edit
45
44
  end
@@ -47,9 +46,9 @@ RSpec.describe Admin::TbRedirectsController, :type => :controller do
47
46
 
48
47
  describe 'create' do
49
48
  it 'should create the record' do
50
- expect{
51
- post :create, :tb_redirect => FactoryGirl.attributes_for(:tb_redirect)
52
- }.to change(TbRedirect, :count).by(1)
49
+ expect do
50
+ post :create, params: { tb_redirect: FactoryGirl.attributes_for(:tb_redirect) }
51
+ end.to change(TbRedirect, :count).by(1)
53
52
  end
54
53
  end
55
54
 
@@ -58,20 +57,19 @@ RSpec.describe Admin::TbRedirectsController, :type => :controller do
58
57
  tb_redirect = FactoryGirl.create(:tb_redirect)
59
58
  current_value = tb_redirect.source
60
59
  new_value = current_value + '-Updated'
61
- expect{
62
- patch :update, :id => tb_redirect.id, :tb_redirect => {:source => new_value}
60
+ expect do
61
+ patch :update, params: { id: tb_redirect.id, tb_redirect: { source: new_value } }
63
62
  tb_redirect.reload
64
- }.to change(tb_redirect, :source).to(new_value)
63
+ end.to change(tb_redirect, :source).to(new_value)
65
64
  end
66
65
  end
67
66
 
68
67
  describe 'destroy' do
69
68
  it 'should destroy the record' do
70
69
  tb_redirect = FactoryGirl.create(:tb_redirect)
71
- expect{
72
- delete :destroy, :id => tb_redirect.id
73
- }.to change(TbRedirect, :count).by(-1)
70
+ expect do
71
+ delete :destroy, params: { id: tb_redirect.id }
72
+ end.to change(TbRedirect, :count).by(-1)
74
73
  end
75
74
  end
76
-
77
75
  end
@@ -1,25 +1,23 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe ApplicationController, type: :controller do
4
-
5
4
  controller do
6
5
  def index
7
- raise Spud::NotFoundError.new
6
+ raise Spud::NotFoundError
8
7
  end
9
8
  end
10
9
 
11
10
  describe '#check_for_applicable_redirect' do
12
11
  it 'should redirect' do
13
- FactoryGirl.create(:tb_redirect, :source => '/anonymous', :destination => '/redirected')
12
+ FactoryGirl.create(:tb_redirect, source: '/anonymous', destination: '/redirected')
14
13
  get :index
15
14
  expect(response).to redirect_to('/redirected')
16
15
  end
17
16
 
18
17
  it 'should not redirect' do
19
- FactoryGirl.create(:tb_redirect, :source => '/other', :destination => '/redirected')
18
+ FactoryGirl.create(:tb_redirect, source: '/other', destination: '/redirected')
20
19
  get :index
21
20
  expect(response).to_not redirect_to('/redirected')
22
21
  end
23
22
  end
24
-
25
23
  end
data/spec/dummy/bin/setup CHANGED
@@ -2,15 +2,15 @@
2
2
  require 'pathname'
3
3
 
4
4
  # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
6
 
7
7
  Dir.chdir APP_ROOT do
8
8
  # This script is a starting point to setup your application.
9
9
  # Add necessary setup steps to this file:
10
10
 
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
11
+ puts '== Installing dependencies =='
12
+ system 'gem install bundler --conservative'
13
+ system 'bundle check || bundle install'
14
14
 
15
15
  # puts "\n== Copying sample files =="
16
16
  # unless File.exist?("config/database.yml")
@@ -18,12 +18,12 @@ Dir.chdir APP_ROOT do
18
18
  # end
19
19
 
20
20
  puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
21
+ system 'bin/rake db:setup'
22
22
 
23
23
  puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
24
+ system 'rm -f log/*'
25
+ system 'rm -rf tmp/cache'
26
26
 
27
27
  puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
28
+ system 'touch tmp/restart.txt'
29
29
  end
@@ -3,13 +3,13 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require(*Rails.groups)
6
- require "tb_redirects"
6
+ require 'tb_redirects'
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
10
10
  Spud::Core.configure do |config|
11
- config.site_name = "Dummy"
12
- config.from_address = "no-reply@dummy.com"
11
+ config.site_name = 'Dummy'
12
+ config.from_address = 'no-reply@dummy.com'
13
13
  end
14
14
 
15
15
  # Settings in config/environments/* take precedence over those specified here.
@@ -23,9 +23,5 @@ module Dummy
23
23
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
24
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
25
  # config.i18n.default_locale = :de
26
-
27
- # Do not swallow errors in after_commit/after_rollback callbacks.
28
- config.active_record.raise_in_transactional_callbacks = true
29
26
  end
30
27
  end
31
-
@@ -22,7 +22,7 @@ Rails.application.configure do
22
22
 
23
23
  # Disable serving static files from the `/public` folder by default since
24
24
  # Apache or NGINX already handles this.
25
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
25
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
26
 
27
27
  # Compress JavaScripts and CSS.
28
28
  config.assets.js_compressor = :uglifier
@@ -13,8 +13,8 @@ Rails.application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static file server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
18
18
 
19
19
  # Show full error reports and disable caching.
20
20
  config.consider_all_requests_local = true
@@ -2,21 +2,20 @@
2
2
  class CreateSpudUsers < ActiveRecord::Migration
3
3
  def change
4
4
  create_table :spud_users do |t|
5
-
6
5
  t.string :first_name
7
6
  t.string :last_name
8
7
  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
8
+ t.string :login, null: false # optional, you can use email instead, or both
9
+ t.string :email, null: false # optional, you can use login instead, or both
10
+ t.string :crypted_password, null: false # optional, see below
11
+ t.string :password_salt, null: false # optional, but highly recommended
12
+ t.string :persistence_token, null: false # required
13
+ t.string :single_access_token, null: false # optional, see Authlogic::Session::Params
14
+ t.string :perishable_token, null: false # optional, see Authlogic::Session::Perishability
16
15
 
17
16
  # 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
17
+ t.integer :login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
18
+ t.integer :failed_login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
20
19
  t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
21
20
  t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
22
21
  t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
@@ -2,6 +2,5 @@
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
@@ -2,6 +2,5 @@
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
@@ -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