Sha256: 9008bbe6998b6c103ba4abfea0cd89f00f48830f2a7bbd1034361d14e3de2249

Contents?: true

Size: 543 Bytes

Versions: 4

Compression:

Stored size: 543 Bytes

Contents

module Theblog
  class ContentNodesController < Theblog::ApplicationController
    def show
      @node = Theblog::ContentNode.published.
        by_parent(params[:category]).
        find_by(slug: params[:slug])

      if @node.is_a? Theblog::Category
        @posts = @node.child_nodes.published.order("created_at DESC").page params[:page]
      end

      redirect_to theblog.root_path, notice: "Content not found" unless @node.present?
    end

    private def comment
      @node.comments.new
    end
    helper_method :comment
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
theblog-0.0.2.3 app/controllers/theblog/content_nodes_controller.rb
theblog-0.0.2.2 app/controllers/theblog/content_nodes_controller.rb
theblog-0.0.2.1 app/controllers/theblog/content_nodes_controller.rb
theblog-0.0.2 app/controllers/theblog/content_nodes_controller.rb