Sha256: d8c24c07b9d9059e975a34060e876ddb5a3056eeef336c8c8928b7ce9516590a

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

class <%= class_name %> < ActiveRecord::Base
  acts_as_humpyard_page
  
  <% if attributes.size > 0 -%>
attr_accessible <%= attributes.map{|attribute| attribute.reference? ? ":#{attribute.name}, :#{attribute.name}_id" : ":#{attribute.name}"} * ', ' %>
  <% end -%> 
  <% attributes.select {|attr| attr.reference? }.each do |attribute| -%>
belongs_to :<%= attribute.name %>
  <% end -%>
  
  def parse_path(path)
    # return nil if path.size != 1
    #
    # item = items.find_by_title_for_url(path[0])
    # return nil if item.nil?
    #
    # return {
    #   :partial => 'detail',
    #   :locals => {:item => item}
    # }
  end
  
  #
  # Remove this function if page is not dynamic
  #
  def child_pages
   []
  end
  
  def site_map(locale)
    {
      :url => page.human_url(:locale => locale),
      :lastmod => page.last_modified,
      :children => []  # ToDo: return list of dynamic content pages  
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
humpyard-0.0.1 lib/generators/humpyard/page/templates/model.rb