Sha256: eb48562bfa7a570c28fcee11c34595cb1250a2404cf0bf929f0b1df867c361a9

Contents?: true

Size: 570 Bytes

Versions: 8

Compression:

Stored size: 570 Bytes

Contents

require 'json'

class <%= @scaffold.controller_name %>Controller < ApplicationController
  def show
    # Standard find by ID
    <%= "@#{@scaffold.model_file_name}" %> = <%= @scaffold.model_name %>.find(params[:id])
    # Find by path
    <%= "@#{@scaffold.model_file_name}" %> = <%= @scaffold.model_name %>.find_by_path(request.path)
    if <%= "@#{@scaffold.model_file_name}" %>
      render :show
    else
      render file: "#{Rails.root}/public/404.html", status: :not_found
      Rails.logger.error "404 - Page #{request.path} cannot be found."
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
atomic_cms-0.4.0 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.3.3 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.3.2 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.3.1 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.3.0 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.2.5 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.2.3 lib/generators/atomic_cms/templates/controller.erb
atomic_cms-0.2.2 lib/generators/atomic_cms/templates/controller.erb