We use a different logic to load the card depending on the controller we're using, and then share the rest of the code. This way we simplify the code a bit, since we don't have to check for the page_id parameter.
15 lines
399 B
Ruby
15 lines
399 B
Ruby
class Admin::SiteCustomization::CardsController < Admin::SiteCustomization::BaseController
|
|
include Admin::Widget::CardsActions
|
|
load_and_authorize_resource :page, class: "::SiteCustomization::Page"
|
|
load_and_authorize_resource :card, through: :page, class: "Widget::Card"
|
|
|
|
def index
|
|
end
|
|
|
|
private
|
|
|
|
def index_path
|
|
admin_site_customization_page_widget_cards_path(@page)
|
|
end
|
|
end
|