Updating Phoenix from 0.3.1 to 0.4.0

Problem

You would like to upgrade to the latest version of Phoenix 0.4.0 from the previous version of 0.3.1. When you try to update the dependencies and try to start phoenix again (mix phoenix.start) you get the following error:

** (Mix) You're trying to run :your_app_name on Elixir v1.0.0-rc1 
but it has declared in its mix.exs file it supports 
only Elixir ~> 0.15.0

Solution

After upgrading your Elixir version to the latest (1.0.0-rc1), and updating the path to your elixir installation so that it uses the new one, clear the dependencies from your project:

mix deps.clear --all

Change the dependency in your mix.exs file to be as the following:

def project do
    [ app: :your_app_name,
      version: "0.0.1",
      elixir: "~> 1.0.0-rc1",
      elixirc_paths: ["lib", "web"],
      deps: deps ]
  end

and then get the dependencies again with:

mix deps.get

after that you should be able to start your phoenix project with tne new version.

Upgrading jquery-ui-rails from 4.2.1 to 0.5.0

Problem

You would like to upgrade your jquery-ui-rails gem from a version before 0.5.x to the latest version 0.5.0, but when you do that your tests are failing with error messages similar to the one below:

ActionView::Template::Error: 
couldn't find file 'jquery.ui.effect-blind'

Solution

According to the changelog the naming between 4.2.1 and 0.5.0 has changed jquery-ui-rails

So if you were using something like the following in your app/assets/javascripts/applications.js file (as used in the depot example in the Agile Web Development with Rails 4 book):

//= require jquery.ui.effect-blind

you would need to change it to the following after upgrading your jquery-ui-rails gem to ~> 0.5.0:

//= require jquery-ui/effect-blind

Upgrading Ruby on Rails application from 1.2.3 to 2.0.2

Problem
Upgrading an existing Ruby on Rails application from 1.2.3, to 2.0.2, presents few problems. I will try and keep a record of the ones I encounter along the way, here.

Solution

  1. Change the config/environment.rb to let the application know to use the 2.0.2 gem rail version,
  2. change the following line from:

    RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION

    to:

    RAILS_GEM_VERSION = "2.0.2" unless defined? RAILS_GEM_VERSION
  3. Run the following to generate the secret key for the application:
  4. rake secret
  5. Copy the magic key in a new section in your config/environment.rb as in:
  6. ...
    
        # config.log_level = :debug
    
        # Your secret key for verifying cookie session data integrity.
        # If you change this key, all old sessions will become invalid!
        # Make sure the secret is at least 30 characters and all random,
        # no regular words or you'll be exposed to dictionary attacks.
        config.action_controller.session = {
          :session_key => '_yourapplication_session',
          :secret      => 'long_string_generated_from_rake_secret'
        }