Developer Upgrade Notes
Radiant Extensions may now create routes in the extension’s config/routes.rb file.
Radiant now supports nested navigation. Selecting a tab in the interface will bring you to the first listed navigation item for that tab. You will no longer just add a single tab for each area you need to add. You may add links to existing tabs, or add your own tabs and add links there.
Additionally, tab visibility is no longer determined when adding the tab, but the controllers will be checked for a user’s access to the path specified.
Old:
def activate
admin.tabs.add "Advertisements", "/admin/advertisements", :after => "Layouts", :visibility => [:all]
end
New:
def activate
tab "Content" do
add_item "Advertisements", "/admin/advertisements", :after => "Pages"
end
tab "Advertisements" do # or, add your own tab
add_item "Recently Created", "/admin/advertisements/recent"
add_item "Expiring", "/admin/advertisements/expiring"
end
end
Using the old style “admin.tabs.add” will continue to work in 0.9 (placing links in the “Content” tab) but it is deprecated and will be removed in a future version.
The default tabs are “Content” (consisting of Pages) and “Design” (consisting of Snippets and Layouts).
Be sure to set “only_allow_acces_to” in your controller if you need to restrict access based on a user’s role (see an example in the layouts controller.)
Old:
order_by :name
New:
default_scope :order => "name ASC"
application.rb
has changed to application_controller.rb
in accordance with Rails convention.
Old:
require_dependency 'application'
New:
require_dependency 'application_controller'
Remove all references to ResponseCache
.
If you want to cache non-page items, simply apply an appropriate Cache-Control
header to your response using ActionController’s expires
method. Use expires_now
to prevent caching.
To manually clear the cache:
Radiant::Cache.clear
Radiant::Cache
is built on top of Rack::Cache
, which is included in vendor. As a result of this change, SiteController
no longer has a show_uncached_page
method. All requests to SiteController
imply an uncached or expired page.
Now uses RSpec 1.2.4 (exact version), any 0.3 family version of Cucumber, and Webrat 0.4.4 or greater (in the same family). These are added as gem dependencies to config/environments/test.rb
. spec_integration
is no longer used.
Rails 2.3.2 is included. Please refer to information on upgrading from Rails 2.1.x for any significant changes there.
Before 0.7.x Radiant used to have things like Admin::PageController and Admin::SnippetController (i.e. singular controller names). .As of Radiant 0.7.0, Radiant now complies with Rails’ naming conventions and uses plural controller names like Admin::PagesController and Admin::SnippetsController.
From 0.6.5 to 0.6.9, Radiant used the scenarios gem to load test data. With version 0.7.0, scenarios were replaced with datasets, which share a very similar API, but enable the test data to load much faster. If you were using scenarios to load test data in your extension before version 7, you need only make a few small modifications to make the switch to datasets.
Look for the following lines in the file spec/spec_helper
:
require 'scenarios'
if File.directory?(File.dirname(__FILE__) + "/scenarios")
Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
end
Delete those lines, and replace them with the following line:
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
You should also replace all references to scenarios with datasets. In particular, look out for the following:
- rename the
spec/scenarios
folder tospec/datasets
- rename all files within the
spec/datasets
folder ending in_scenario
to end with_dataset
- change all classes which inherit from
Scenario::Base
to inherit instead fromDataset::Base
. The class name itself may also have to change, e.g.class UsersScenario < Scenario::Base
would becomeclass UsersDataset < Dataset::Base
- when loading data into your specs, replace
scenario
withdataset
, e.g.scenario :users
would becomedataset :users
The API for datasets is identical to that of scenarios, so you should not have to modify the actual dataset files.