Class CategoriesController
In: app/controllers/categories_controller.rb
Parent: ApplicationController

Controlador de las categorías del menú

Methods

index   show  

Public Instance methods

Índice de categorías

[Source]

   # File app/controllers/categories_controller.rb, line 4
4:   def index
5:     @tree = Tree.find_menu_tree
6:     @title = "Categorías"
7:   end

Vista de una categoría y todos los contenidos que tiene dentro

[Source]

    # File app/controllers/categories_controller.rb, line 10
10:   def show
11:     @category = Category.find(params[:id])
12:     
13:     category_tag_ids = Tagging.find_all_by_taggable_type_and_taggable_id('Category', @category.id).collect(&:tag_id)
14:     if category_tag_ids.length > 0 
15:       conditions = "tag_id in (#{category_tag_ids.join(', ')}) AND NOT (taggable_id=#{@category.id} AND taggable_type='Category')"
16:     else
17:       conditions = "1=0"
18:     end
19: 
20:     @taggings = paginated_collection_of_tags_for(conditions, :page => params[:page] || 1)
21:     
22:     # if @taggings.length == 1  
23:     #   redirect_to @taggings.first.taggable and return
24:     # end
25:   end

[Validate]