Spree Commerce

Try It Now

Rails 2.3.2 and Other Configuration Changes

Posted on April 06, 2009 by Sean Schofield

I recently finished updating the spree-demo project to use the latest code. It reminded me that there were several small required configuration changes that you should be aware of if you’re trying to upgrade an existing app.

The first thing to do is change the rails version in config/boot.rb from Rails 2.2.2 to Rails 2.3.2 by replacing


<p>load_rails(&#8220;~&gt;2.2.2&#8221;)  # note: spree requires rails 2.2.2 (change at your own risk)</p>

with


<p>load_rails(&#8220;2.3.2&#8221;)  # note: spree requires rails 2.3.2 (change at your own risk)</p>

The next step is to map the new resources and routes in config/routes.rb. Start by removing the old login routes below


<p>map.login &#8216;/login&#8217;, :controller =&gt; &#8216;account&#8217;, :action =&gt; &#8216;login&#8217;<br />
map.logout &#8216;/logout&#8217;, :controller =&gt; &#8216;account&#8217;, :action =&gt; &#8216;logout&#8217;<br />
map.signup &#8216;/signup&#8217;, :controller =&gt; &#8216;users&#8217;, :action =&gt; &#8216;new&#8217;<br />
map.admin &#8216;/admin&#8217;, :controller =&gt; &#8216;admin/overview&#8217;, :action =&gt; &#8216;index&#8217;</p>

and replace with these lines:


<p>map.resource :user_session<br />
map.resource :account, :controller =&gt; &#8220;users&#8221;</p>
<p>map.resources :password_resets</p>
<ol>
	<li>login mappings should appear before all others<br />
map.login &#8216;/login&#8217;, :controller =&gt; &#8216;user_sessions&#8217;, :action =&gt; &#8216;new&#8217;<br />
map.logout &#8216;/logout&#8217;, :controller =&gt; &#8216;user_sessions&#8217;, :action =&gt; &#8216;destroy&#8217;<br />
map.signup &#8216;/signup&#8217;, :controller =&gt; &#8216;users&#8217;, :action =&gt; &#8216;new&#8217;<br />
map.admin &#8216;/admin&#8217;, :controller =&gt; &#8216;admin/overview&#8217;, :action =&gt; &#8216;index&#8217;<br />

You’ll also want to make sure that your config/environment.rb file contains exactly these entries:


<p>config.gem &#8220;highline&#8221;, :version =&gt; &#8216;1.4.0&#8217;<br />
config.gem &#8216;authlogic&#8217;, :version =&gt; &#8216;2.0.5&#8217;<br />
config.gem &#8220;activemerchant&#8221;, :lib =&gt; &#8220;active_merchant&#8221;, :version =&gt; &#8216;1.4.1&#8217;<br />
config.gem &#8220;tlsmail&#8221;, :version =&gt; &#8216;0.0.1&#8217;<br />
config.gem &#8216;active_presenter&#8217;, :version =&gt; &#8216;0.0.6&#8217;<br />
config.gem &#8216;activerecord-tableless&#8217;, :lib =&gt; &#8216;tableless&#8217;, :version =&gt; &#8216;0.1.0&#8217;<br />
config.gem &#8216;calendar_date_select&#8217;, :version =&gt; &#8216;1.15&#8217;<br />
config.gem &#8216;haml&#8217;, :version =&gt; &#8216;2.1.0&#8217;<br />
config.gem &#8216;chriseppstein-compass&#8217;, :lib =&gt; &#8216;compass&#8217;, :version =&gt; &#8216;0.5.4&#8217;</p>
<ol>
	<li><span class="caps">HACKED</span> version of search logic &#8211; we&#8217;ll move back when our fix is accepted into core<br />
config.gem &#8216;schof-searchlogic&#8217;, :lib =&gt; &#8216;searchlogic&#8217;, :version =&gt; &#8216;0.0.2&#8217;</li>
</ol>

The authlogic gem version has been incremented (and is likely to increment again because of bug fixes.) The calendar_date_select plugin has been removed and replaced with a gem (so you will need to install that.) The has_many_polymoprhs gem has been removed entirely because of problems getting it to work in Rails 2.3. You’ll also need the haml and compass gems listed above. The haml gem needs to be built from source (in GitHub) and the compass gem is available in GitHub’s gem repository. Both gems are also “vendored” in the edge source if you wanted to copy them into a current deployment.

If you are working on a brand new project using the edge Spree code, none of these steps should be necessary. This is just to help you get an existing Spree deployment up and running.