Use Rails 5 conventions in Dashboard

These models and migrations were added on a branch based on Rails 4.
This commit is contained in:
Javi Martín
2019-04-26 15:18:23 +02:00
committed by voodoorai2000
parent 8094417828
commit c43b0fea64
21 changed files with 21 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
class AdministratorTask < ActiveRecord::Base
class AdministratorTask < ApplicationRecord
belongs_to :source, polymorphic: true
belongs_to :user

View File

@@ -1,4 +1,4 @@
class Dashboard::Action < ActiveRecord::Base
class Dashboard::Action < ApplicationRecord
include Documentable
documentable max_documents_allowed: 3,
max_file_size: 3.megabytes,

View File

@@ -1,4 +1,4 @@
class Dashboard::AdministratorTask < ActiveRecord::Base
class Dashboard::AdministratorTask < ApplicationRecord
belongs_to :source, polymorphic: true
belongs_to :user

View File

@@ -1,4 +1,4 @@
class Dashboard::ExecutedAction < ActiveRecord::Base
class Dashboard::ExecutedAction < ApplicationRecord
belongs_to :proposal
belongs_to :action, class_name: "Dashboard::Action"

View File

@@ -1,4 +1,4 @@
class Link < ActiveRecord::Base
class Link < ApplicationRecord
belongs_to :linkable, polymorphic: true
validates :label, presence: true

View File

@@ -1,4 +1,4 @@
class AddPublishedAtToProposal < ActiveRecord::Migration
class AddPublishedAtToProposal < ActiveRecord::Migration[4.2]
def change
add_column :proposals, :published_at, :datetime, null: true
end

View File

@@ -1,4 +1,4 @@
class CreateProposalDashboardActions < ActiveRecord::Migration
class CreateProposalDashboardActions < ActiveRecord::Migration[4.2]
def change
create_table :proposal_dashboard_actions do |t|
t.string :title, limit: 80

View File

@@ -1,4 +1,4 @@
class AddActionTypeToProposalDashboardActions < ActiveRecord::Migration
class AddActionTypeToProposalDashboardActions < ActiveRecord::Migration[4.2]
def change
add_column :proposal_dashboard_actions, :action_type, :integer, null: false, default: 0
end

View File

@@ -1,4 +1,4 @@
class CreateProposalExecutedDashboardActions < ActiveRecord::Migration
class CreateProposalExecutedDashboardActions < ActiveRecord::Migration[4.2]
def change
create_table :proposal_executed_dashboard_actions do |t|
t.references :proposal, index: true, foreign_key: true

View File

@@ -1,4 +1,4 @@
class CreateAdministratorTasks < ActiveRecord::Migration
class CreateAdministratorTasks < ActiveRecord::Migration[4.2]
def change
create_table :administrator_tasks do |t|
t.references :source, polymorphic: true, index: true

View File

@@ -1,4 +1,4 @@
class AddRelatedToPolls < ActiveRecord::Migration
class AddRelatedToPolls < ActiveRecord::Migration[4.2]
def change
add_reference :polls, :related, index: true, polymorphic: true
end

View File

@@ -1,4 +1,4 @@
class AddShortDescriptionToProposalDashboardActions < ActiveRecord::Migration
class AddShortDescriptionToProposalDashboardActions < ActiveRecord::Migration[4.2]
def change
add_column :proposal_dashboard_actions, :short_description, :string
change_column :proposal_dashboard_actions, :description, :text

View File

@@ -1,4 +1,4 @@
class CreateLinks < ActiveRecord::Migration
class CreateLinks < ActiveRecord::Migration[4.2]
def change
create_table :links do |t|
t.string :label

View File

@@ -1,4 +1,4 @@
class RemoveCommentsFromProposalExecutedDashboardAction < ActiveRecord::Migration
class RemoveCommentsFromProposalExecutedDashboardAction < ActiveRecord::Migration[4.2]
def change
remove_column :proposal_executed_dashboard_actions, :comments, :text
end

View File

@@ -1,4 +1,4 @@
class RenameProposalDashboardActionsToDashboardActions < ActiveRecord::Migration
class RenameProposalDashboardActionsToDashboardActions < ActiveRecord::Migration[4.2]
def change
rename_table :proposal_dashboard_actions, :dashboard_actions
rename_column :proposal_executed_dashboard_actions, :proposal_dashboard_action_id, :dashboard_action_id

View File

@@ -1,4 +1,4 @@
class RenameProposalExecutedDashboardActionsToDashboardExecutedActions < ActiveRecord::Migration
class RenameProposalExecutedDashboardActionsToDashboardExecutedActions < ActiveRecord::Migration[4.2]
def change
rename_table :proposal_executed_dashboard_actions, :dashboard_executed_actions
end

View File

@@ -1,4 +1,4 @@
class RenameAdministratorTaskToDashboardAdministratorTask < ActiveRecord::Migration
class RenameAdministratorTaskToDashboardAdministratorTask < ActiveRecord::Migration[4.2]
def change
rename_index :administrator_tasks, 'index_administrator_tasks_on_source_type_and_source_id', 'index_dashboard_administrator_tasks_on_source'
rename_table :administrator_tasks, :dashboard_administrator_tasks

View File

@@ -1,4 +1,4 @@
class RenameDashboardActionIdToActionId < ActiveRecord::Migration
class RenameDashboardActionIdToActionId < ActiveRecord::Migration[4.2]
def change
rename_column :dashboard_executed_actions, :dashboard_action_id, :action_id
end

View File

@@ -1,4 +1,4 @@
class AddTimestampsToDashboardActions < ActiveRecord::Migration
class AddTimestampsToDashboardActions < ActiveRecord::Migration[4.2]
def change
add_column :dashboard_actions, :created_at, :datetime
add_column :dashboard_actions, :updated_at, :datetime

View File

@@ -1,4 +1,4 @@
class AddPublishedProposalToDashboardActions < ActiveRecord::Migration
class AddPublishedProposalToDashboardActions < ActiveRecord::Migration[4.2]
def change
add_column :dashboard_actions, :published_proposal, :boolean, default: :false
end

View File

@@ -1,4 +1,4 @@
class RemoveOpenInNewTabFromLinks < ActiveRecord::Migration
class RemoveOpenInNewTabFromLinks < ActiveRecord::Migration[4.2]
def change
remove_column :links, :open_in_new_tab, :boolean
end