0

I inherited a Rails 3.1 app, served by passenger/nginx.

I thought I had to upgrade from ActiveAdmin 0.4 to 0.5, but that caused other problems, so I found a workaround and downgraded to 0.4.0.

Then Ruby started complaining that the formtastic-bootstrap gem wasn't checked out. Here's the line in the Gemfile:

gem 'formtastic-bootstrap',   :git => "git://github.com/cgunther/formtastic-bootstrap.git", :branch => "bootstrap-2"

And there certainly was a f-b gem in the config, but then someone on stackoverflow said to run

bundle install --deployment

and after I ran that incantation, the site loaded. Except all the ActiveAdmin CSS is gone. I can make small mods to the file assets/active_admin.css and they take effect, but the site otherwise looks like times roman crap.

So I did something bad during one of the above steps -- I normally run bundle install as root, but the site is owned by 'web'. And after Ruby complained that it couldn't find formtastic-bootstrap, I found two of those gems installed in /home/web/.bundler/ruby/ (or something like that), and because Ruby must have been complaining about them, I deleted them. There wasn't anything else there.

After running another bundle install, the site would then load, but the CSS wasn't taking effect.

I loaded up the reference site in a different tab, and compared the HTML I've generated with the reference HTML. The only difference is in the two lines that load the JS and CSS. In the reference site:

<link href="/assets/active_admin-e1b0dc3ef3753e264638b07b12174adb.css" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/active_admin-385197d3f18a204049d4eb22bc9a033e.js" type="text/javascript"></script>

In mine:

<link href="/assets/active_admin.css" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/active_admin.js" type="text/javascript"></script>

I know the JS and CSS are being loaded, because I see the alert, and other things get colorized, just not the ActiveAdmin elements. But the DOM inspector shows that the reference site is pulling all sorts of things out of that CSS file for the body element, while for my page, it's only pulling generic style rules out of resource://gre-resources/html.css and a data URI that doesn't need repeating here.

The Error Console is full of the usual jquery and google.maps JS admonitions (it's a gmap app), but nothing jumps out.

Does this ring a bell for anyone? I gather the reason why I'm seeing untagged CSS and JS file references is because of that "bundle install --deployment" I ran, followed by "bundle install --no-deployment" when things got worse. I just want to set things back to square 1.

So how can I just clear everything? Or better still, is are there a bunch of magic doodads being cached somewhere?

Nakilon
  • 34,866
  • 14
  • 107
  • 142
Eric
  • 2,115
  • 2
  • 20
  • 29

1 Answers1

1

You could try doing a bundle uninstall

another possibility is to rename the Gemfile.lock and rerunning bundle install, this will force a full re-install.

If you are using version control, such as Git, you could run a diff and see what changes have been made to the code and comparing.

muttonlamb
  • 6,341
  • 3
  • 26
  • 35
  • Well, all the gems are loading now, so I won't take that route, as I have multiple apps all working out of /usr/local/bin/ruby (I couldn't get rvm installed as root working on this machine). The main problem now is figuring out why sometimes the HTML loads plain active_admin.css, and othertimes it loads a tagged variant of active_admin.css – Eric Mar 17 '13 at 15:31
  • What's the structure of your assets/stylesheets? I've had problems before with multiple files in there (such as auto created ones from generators). They can then override each other... – muttonlamb Mar 17 '13 at 16:51
  • That's a really good question, and my $64K answer is I'm not sure. I inherited this code, which uses ActiveAdmin, and I'm finding it convoluted and baffling. I ran into a bug in ActiveAdmin 0.4.0, went to its github page, and found it was fixed in 0.5.0. After I upgraded, I found it could no longer resolve its locale strings. The CSS problem happens when I retrograde to 0.4.0. The problem turns out to be simple, in terms of its symptoms. – Eric Mar 17 '13 at 20:24
  • 0.4.0: load stylesheet activeadmin.css – Eric Mar 17 '13 at 20:25
  • 0.5.0: load active_admin-970352a85ac958a288fbbeb01eda6b07.css" and now the CSS is fine, but I get translation_missing warnings emitted in the HTML. – Eric Mar 17 '13 at 20:27
  • translation_missing refers to information in your locales files. There is a bit of information on the active_admin website [link](http://activeadmin.info/docs/1-general-configuration.html#internationalization_i18n) Basically if you put their internationalization stuff in your en.yml file, it should be resolved – muttonlamb Mar 18 '13 at 03:30
  • ActiveAdmin 0.4.0 found the strings in the locale file, but 0.5.0 can't. Which tells me that maybe the strings didn't get updated (?). But after talking to someone who's been there, bought the t-shirt, and found it didn't fit, I'm pulling ActiveAdmin out and replacing it with a smaller set of controllers and views that do everything I need. – Eric Mar 18 '13 at 16:05