mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 11:17:49 +01:00
Fix bug in boards load and destroy belonging posts when destroying board
This commit is contained in:
@@ -10,6 +10,6 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_boards
|
def load_boards
|
||||||
@boards = Board.all.only(:id, :name)
|
@boards = Board.select(:id, :name).order(order: :asc)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
class Board < ApplicationRecord
|
class Board < ApplicationRecord
|
||||||
|
has_many :posts, dependent: :destroy
|
||||||
|
|
||||||
after_initialize :set_order_to_last
|
after_initialize :set_order_to_last
|
||||||
|
|
||||||
validates :name, presence: true, uniqueness: true
|
validates :name, presence: true, uniqueness: true
|
||||||
|
|||||||
Reference in New Issue
Block a user