Skip to content

Instantly share code, notes, and snippets.

@henare
Last active December 14, 2015 12:39
Show Gist options
  • Save henare/5088019 to your computer and use it in GitHub Desktop.
Save henare/5088019 to your computer and use it in GitHub Desktop.
Alaveteli Theme Upgrade Checks

Alaveteli Theme Upgrade Checks

RAILS_ROOT/RAILS_ENV

Example

Check your theme for instances of:

  • RAILS_ROOT replace with Rails.root
  • RAILS_ENV replace with Rails.env

Dispatcher

Example

This...

require 'dispatcher'
Dispatcher.to_prepare do

should be replaced with this...

Rails.configuration.to_prepare do

Routes

Example

You need to upgrade your custom routes to the new Rails syntax.

list_public_bodies_default removed

Example

The list_public_bodies_default helper has been removed from Alaveteli

Patching mailer templates has changed

Example

In lib/patch_mailer_paths.rb change ActionMailer::Base.view_paths.unshift File.join(File.dirname(__FILE__), "views") to ActionMailer::Base.prepend_view_path File.join(File.dirname(__FILE__), "views")

Rename view templates

Example

Rename view templates from filename.rhtml to filename.html.erb.

Run this in the root of your theme directory: ruby -e 'Dir.glob("lib/views/**/*.rhtml").each { |f| `git mv #{f} #{f.gsub(".rhtml", ".html.erb")}` }'

GOTCHA! One exception is mailer templates, these should be renamed to filename.text.erb as we only use text emails.

The Configuration class has been renamed

Example

Due to a naming conflict, Configuration has been renamed to AlaveteliConfiguration.

You'll may have this in your them for things like Configuration::site_name, just change it to AlaveteliConfiguration::site_name

request.request_uri is deprecated

Example

Replace instances of request.request_uri with request.fullpath

<% %> style block helpers are deprecated

Example

See example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment