Sha256: 9011a0dff24b4b1da6a7ebfebf47233345ccb8200bef2d64151761d74612fb29

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

class Odania::ContentsController < ApplicationController
	before_filter :valid_site!

	def index
		@odania_contents = current_site.contents

		unless params[:tag].nil?
			odania_tag = Odania::Tag.where(name: params[:tag], language_id: current_menu.language_id).first
			@odania_contents = @odania_contents.joins(:tags).where(odania_tag_xrefs: {tag_id: odania_tag.id}) unless odania_tag.nil?
		end

		@odania_contents = @odania_contents.where(language_id: current_menu.language_id).order('created_at DESC')
	end

	def show
		@odania_content = current_site.contents.where(id: params[:id], language_id: current_menu.language_id).first

		return render_not_found if @odania_content.nil?
		return redirect_to odania_content_path(id: @odania_content.to_param) unless @odania_content.to_param.eql? params[:id]
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
odania_core-0.0.7 app/controllers/odania/contents_controller.rb
odania_core-0.0.6 app/controllers/odania/contents_controller.rb
odania_core-0.0.5 app/controllers/odania/contents_controller.rb