Sha256: 5640cb394caa8cb4fa32967f808c6f2200db6b67a221b5ac561613de20e1ecf2

Contents?: true

Size: 902 Bytes

Versions: 1

Compression:

Stored size: 902 Bytes

Contents

# frozen_string_literal: true

class ServicesController < ApplicationController
  before_action :find_structure, only: :index
  before_action :current_structure, only: :show

  caches_page :index, :show

  def index
    @services = @structure.children
    # @rates = ReviewRate.visible.sorted.limit(3)
    respond_with @services
  end

  def show
    respond_with @structure
  end

  private

  def find_structure
    load_structure(StructureType.services)
  end

  def current_structure
    @structure = Structure.visible.find_by(id: params[:id])
    @structure ||= Structure.visible.find_by(slug: params[:slug])
    raise ActiveRecord::RecordNotFound, "Structure #{params[:slug]} not found" unless @structure
    # @structure = Structure.visible.with_type(StructureType.page).where(slug: params[:id]).first
    # if @structure.nil? || !@structure.valid_parents?(params[:parents])
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/controllers/services_controller.rb