Split callbacks for easier overwriting
This commit is contained in:
@@ -2,14 +2,16 @@ class Public::BaseController < ApplicationController
|
||||
allow_unauthenticated_access
|
||||
allow_unauthorized_access
|
||||
|
||||
before_action :set_collection_and_card
|
||||
before_action :set_public_cache_expiration
|
||||
before_action :set_collection, :set_card, :set_public_cache_expiration
|
||||
|
||||
layout "public"
|
||||
|
||||
private
|
||||
def set_collection_and_card
|
||||
def set_collection
|
||||
@collection = Collection.find_by_published_key(params[:collection_id] || params[:id])
|
||||
end
|
||||
|
||||
def set_card
|
||||
@card = @collection.cards.find(params[:id]) if params[:collection_id] && params[:id]
|
||||
end
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
class Public::Collections::ColumnsController < Public::BaseController
|
||||
before_action :set_column, only: :show
|
||||
before_action :set_column
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @column.cards.active.latest.with_golden_first
|
||||
end
|
||||
|
||||
private
|
||||
# Unlike the other public controllers, this is using params[:id] to fetch the column
|
||||
def set_collection_and_card
|
||||
@collection = Collection.find_by_published_key(params[:collection_id])
|
||||
# Unlike the other public controllers, this is using params[:id] to fetch the column instead of the card
|
||||
def set_card
|
||||
end
|
||||
|
||||
def set_column
|
||||
|
||||
Reference in New Issue
Block a user