Skip to content

Latest commit

 

History

History
67 lines (41 loc) · 3.46 KB

README_RAILS3_CHANGES.textile

File metadata and controls

67 lines (41 loc) · 3.46 KB

Views

Security has been tightened in Rails3, forcing you to include _authenticity_token__ with all requests. If you have forms or javascript that submits requests without this token, Rails will destroy the user session, effectively logging the user out (see http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails). The easiest way to make sure this token is properly included in your forms is to generate the forms using the form_tag or form_for view helpers from Rails.

Fixtures

Fixtures are loaded from a directory within the test app_, which is updated when you run rake hyhead:setup_test_app so in order to update a fixture, you must change it in test_support/fixtures and then either re-run rake hyhead:setup_test_app or copy the fixture into tmp/test_app/testsupport/fixtures

Cucumber tests

We have switched from Webrat to Capybara as the driver for our Cucumber tests. If you have been writing your own cucumber tests (you should!) and want to stay in sync with the rest of the hydra developers, you should switch to Capybara and pull all of the step definitions from the hydra code into your local app.

Sometime soon, we hope to wrap our step definitions into the Hydra code itself so that you can use them without having to manually copy the files into your step_definitions directory. This will probably be done in a way that imitates the Factory Girl step definitions

User objects

Blacklight has switched to using devise instead of authlogic as its default user/authentication system. As part of this switch, no longer have a “login” attribute as their unique identifier. Instead, you must use email as the unique identifier. We have added a “login” method that

User Attributes

User attributes (first_name, last_name, full_name, affiliation and photo) have been removed from HydraHead.

Controllers

  • Removed Djatoka (JPEG 2000) support and the GetController

Views

  • removed fluid infusion javascript
  • moved javascripts from the plugin directory. Update your views to remove “:plugin=>:hydra_repository”

What this means:

  • Our sample user “archivist1” is now “archivist1@example.com”.
  • Your cucumber features and rspec tests must use email addresses as the unique identifier for Users

Change your features and role_map YAML files accordingly.

How to upgrade

The sureest and easiest path to upgrading a hydra head application from Rails 2 to Rails 3, is to start a new project from scratch.

  • Create a new rails 3 project
  • Add
    gem ‘blacklight’
    and
    gem ‘hydra-head’
    to the Gemfile
  • run
    bundle install
  • cp -r old_project/vendor/plugin/old_project_plugin/app/* new_project/app
  • cp -r old_project/vendor/plugin/old_project_plugin/lib/* new_project/lib
    <<<<<<< HEAD
  • copy any tests (test, spec, feature, etc) from the old_project_plugin directory to the new project
  • Run the generators
    rails g blackight -devise

    Run the hydra-head generator
    rails g hydra:head -df

    Run the database migrations
    rake db:migrate
    rake db:migrate RAILS_ENV=test
  • If you will be writing cucumber tests, run the cucumber generator
    rails g cucumber:install
  • copy any tests (test, spec, feature, etc) from the old_project_plugin directory to the new project
  • update your solrconfig.xml
  • update your role_map_…yml files to use appropriate identifiers