Added shortcuts
• Added: - shortcuts functionality - shortcuts route, controller, model - shortcut error message for "exists" - shortcut redux - EditShortcutsModal, constant - links to sidebar, sidebar_xs - options to add/remove group, account in GroupOptionsPopover, ProfileOptionsPopover - shortcuts page, feature/list
This commit is contained in:
@@ -3,14 +3,25 @@
|
||||
#
|
||||
# Table name: shortcuts
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8) not null
|
||||
# shortcut_id :bigint(8) not null
|
||||
# shortcut_type :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime
|
||||
# id :bigint(8) not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint(8) not null
|
||||
# shortcut_id :bigint(8) not null
|
||||
# shortcut_type :string default(""), not null
|
||||
#
|
||||
|
||||
class Shortcut < ApplicationRecord
|
||||
|
||||
# enum shortcut_type: {
|
||||
# account: 'account',
|
||||
# group: 'group'
|
||||
# }
|
||||
|
||||
belongs_to :account
|
||||
|
||||
PER_ACCOUNT_LIMIT = 50
|
||||
|
||||
validates_each :account_id, on: :create do |record, _attr, value|
|
||||
record.errors.add(:base, I18n.t('shortcuts.errors.limit')) if Shortcut.where(account_id: value).count >= PER_ACCOUNT_LIMIT
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user