Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rails plugin that enables declarative control over template rendering
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
MIT-LICENSE
README.markdown
Rakefile
init.rb

README.markdown

VersionedTemplates

Ever need to keep multiple versions of templates around? Maybe for A/B testing? Or perhaps a fickle product manager keeps flip-flopping on the layout of a page? This plugin allows you to "replace" a template with another template programatically. An example will explain it best.

Example

class YourController < ApplicationController

  versioned_templates :index => :index_extra_wide

  def index
  end

  def new
  end
end

Requests for new will render new.html.erb (or similar), while requests for index will ignore index.html.erb and instead look for index_extra_wide.html.erb. It also works when an action calls render passing a template name.

You can also send multiple mappings on one line.

versioned_templates {:index => :index_extra_wide, :edit => :special_edit}

Copyright (c) 2009 Jonathan Julian, released under the MIT license

Something went wrong with that request. Please try again.