Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Actually only load rails admin in production mode

This is what I think 28f8db5 was supposed to do.

With the initializer in an "unless Rails.env.production?" block
the entire initializer was being ignored in production mode and
loaded in all other environments, but Rails Admin was still
loading regardless of that. :grin:

This only loads rails admin in production and excludes it from
all other environments. Also keeps non-admins out of /admin_panel
(without the initializer it was free-for-all) and temp fixes #3210
until a new gem is released.
  • Loading branch information...
commit 4c644c336bc96f6ce6658531e85fa5f3ec6683cf 1 parent 1207ded
@stevenh512 stevenh512 authored
View
2  Gemfile
@@ -25,7 +25,6 @@ gem 'omniauth-tumblr'
gem 'omniauth-twitter'
gem 'twitter', '2.0.2'
-gem 'rails_admin'
# mail
@@ -36,6 +35,7 @@ gem 'newrelic_rpm'
gem "rpm_contrib", "~> 2.1.7"
group :production do # we don't install these on travis to speed up test runs
+ gem 'rails_admin'
gem 'rack-ssl', :require => 'rack/ssl'
gem 'rack-rewrite', '~> 1.2.1', :require => false
gem 'rack-piwik', :require => 'rack/piwik'
View
2  config/initializers/rails_admin.rb
@@ -1,6 +1,6 @@
# RailsAdmin config file. Generated on March 24, 2012 15:34
# See github.com/sferik/rails_admin for more informations
-unless Rails.env.production?
+if Rails.env.production?
RailsAdmin.config do |config|
config.authorize_with do
redirect_to main_app.root_path unless current_user.try(:admin?)
View
4 config/routes.rb
@@ -3,7 +3,9 @@
# the COPYRIGHT file.
Diaspora::Application.routes.draw do
- mount RailsAdmin::Engine => '/admin_panel', :as => 'rails_admin'
+ if Rails.env.production?
+ mount RailsAdmin::Engine => '/admin_panel', :as => 'rails_admin'
+ end
get 'oembed' => 'posts#oembed', :as => 'oembed'
# Posting and Reading
Please sign in to comment.
Something went wrong with that request. Please try again.