How to force activerecord version in rails app (Puppet) using config.ru

I hit a bug when using Puppet and stored configs that can be be resolved by downgrading activerecord to 3.0.11. Since I have a few other rails sites running on the same server, I installed version 3.0.11 and now have 3 versions installed.

actionmailer (3.2.1, 2.3.14)
actionpack (3.2.1, 2.3.14)
activemodel (3.2.1, 3.0.11)
activerecord (3.2.1, 3.0.11, 2.3.14)
activeresource (3.2.1, 2.3.14)
activesupport (3.2.1, 3.0.11, 2.3.14)
acts-as-taggable-on (2.1.0)
arel (3.0.0, 2.0.10)
builder (3.0.0, 2.1.2)
bundler (1.0.21)
coderay (1.0.6, 0.9.8)
daemon_controller (0.2.6)
erubis (2.7.0)
facter (1.6.5)
fastercsv (1.5.4)
fastthread (1.0.7)
hiera (0.3.0)
hiera-puppet (0.3.0)
hike (1.2.1)
i18n (0.6.0, 0.5.0, 0.4.2)
journey (1.0.1)
json (1.6.5, 1.4.3)
liquid (2.3.0)
mail (2.4.1)
mime-types (1.16)
multi_json (1.0.4)
mysql (2.8.1)
mysql2 (0.2.18)
net-ldap (0.2.2)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.3.0)
passenger (3.0.11)
pg (0.9.0)
polyglot (0.3.3)
puppet (2.7.6)
puppet-lint (0.1.13)
rack (1.4.1, 1.1.3)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1, 2.3.14)
railties (3.2.1)
rake (0.9.2.2, 0.8.7)
rdoc (3.12)
rest-client (1.6.1)
rmagick (2.13.1)
ruby-openid (2.1.8)
rubytree (0.5.3)
sprockets (2.1.2)
sqlite3-ruby (1.2.5, 1.2.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33, 0.3.31)

According to the bug report all I need to do is add gem 'activerecord', '=2.2.2' require 'activerecord' to my config.ru file to force puppet to use this version of activerecord.

I wasn't sure which config.ru file to add this line to so I tried the three with puppet and rails in the path but none worked i.e. I continued to get the same error ("stack level too deep")

$ locate config.ru
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/test/stub/rack/config.ru
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/test/stub/rails_apps/3.0/empty/config.ru
/usr/lib/ruby/gems/1.8/gems/puppet-2.7.6/ext/rack/files/config.ru
/usr/lib/ruby/gems/1.8/gems/rack-1.4.1/test/rackup/config.ru
/usr/lib/ruby/gems/1.8/gems/rack-test-0.6.1/spec/fixtures/config.ru
/usr/lib/ruby/gems/1.8/gems/rails-2.3.14/dispatches/config.ru
/usr/lib/ruby/gems/1.8/gems/railties-3.2.1/guides/code/getting_started/config.ru
/usr/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/generators/rails/app/templates/config.ru
/usr/share/puppet/ext/rack/files/config.ru

Any ideas on what I could do at this point to force puppet to use activerecord v.3.0.11 without having to uninstall any of the other versions?

Answers


The answer is to modify usr/lib/ruby/site_ruby/1.8/puppet/feature/rails.rb with

Puppet.features.add(:rails) do
   begin
   +    # http://projects.puppetlabs.com/issues/9290
   +    gem 'activerecord', '=3.0.11'
   require 'active_record'
   require 'active_record/version'

Need Your Help

Flatten pandas pivot table

python pandas

This is a follow up of my question. Rather than a pivot table, is it possible to flatten table to look like the following:

IE8 display: none elements pushing down anchor tag

jquery html css internet-explorer-8

I have a page that's setup with an input text field hidden with "display: none" via JQuery toggle(), and an anchor tag located some distance beneath it. When I use the anchor tag, either by enterin...