Module: MuckContents::Routes

Extended by:
ActiveSupport::Concern
Included in:
ActionDispatch::Routing::Mapper
Defined in:
lib/muck-contents/routes.rb

Instance Method Summary collapse

Instance Method Details

#add_routesObject



9
10
11
12
13
# File 'lib/muck-contents/routes.rb', line 9

def add_routes
  routes.each do |route|
    match route[:uri] => 'contents#show', :defaults => { :id => route[:id], :scope => route[:scope] }
  end
end

#routesObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/muck-contents/routes.rb', line 15

def routes
  content_routes = []
  contents = Content.no_contentable.find(:all, :include => 'slugs')
  contents.each do |content|
    content_route = { :uri => content.uri,
                      :scope => content.scope,
                      :id => content.id }
    if !content_routes.include?(content_route)
      content_routes << content_route
    end
  end
  content_routes
end