Class Mapping
In: app/models/mapping.rb
Parent: ActiveRecord::Base

Mappings map parts of folder hierarchy to a specific symbol and rules.

Example action:

  class GalleryController < Application
    def list
      @gallery = Mapping[:Gallery]
    end
  end

Example view:

  <ul>
   <% for image in @gallery.fetch_all %>
         <li><%= mw :link => :link, :document => image %> in <b><%= image.folder_name %> section</b></li>
   <% end %>
  </ul>

Methods

[]   for  

Attributes

folder  [rw]  Root folder of a mapping
index  [rw]  Mapping’s index document
info  [rw]  Optional description
items_on_page  [rw]  Paginator info - items on page
sort_by  [rw]  Field to sort documents stored in mapping by
sort_order  [rw]  ASC or DESC
symbol  [rw] 

Public Class methods

Returns root folder for mapping with a specified symbol

  @photos = Mapping[:Photos]

[Source]

    # File app/models/mapping.rb, line 95
95:   def self.[](sym)
96:     self.for(sym)
97:   end

Alias for Mapping.[]

[Source]

     # File app/models/mapping.rb, line 100
100:   def self.for(sym)
101:     map = find_first(["LOWER(symbol)=LOWER(?)", sym.to_s]) or raise(NoSuchMappingError)
102:     map.folder
103:   end

[Validate]