Skip to content

Upgrading Routes to Rails 3

peakpg edited this page Mar 14, 2011 · 1 revision

BrowserCMS 3.3 uses the new Rails 3 routing API, so any projects or modules will also need to upgrade their routes. (See http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/ for details on the new router). Here's what needs to be changed for BrowserCMS.

Module Routes File

A BrowserCMS 3.1.x module will likely have a file called 'lib/name_of_module/routes.rb', which will look something like this:

# Rails 2 style
module Cms::Routes
  def routes_for_bcms_name_of_module
    namespace(:cms) do |cms|
      #cms.content_blocks :name_of_blocks
    end  
  end
end

In BrowserCMS 3.3, to rework this file to match the new router, here's what it should look like:

# Rails 3 style
module Cms::Routes
  def routes_for_name_of_module
    namespace(:cms) do
      content_blocks :name_of_blocks
    end
  end
end
Clone this wiki locally