Having a buckload of code to authorize users on your application is something you may like or not.
Speaking for myself I hate it. But I still love rails_admin
, here's how you install it without devise. Thanks to phoet for providing the hints in the gist I have forked from.
do NOT add devise
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"
bundle install
It works and just does not install devise.
You may also want to $ rm config/locales/devise*
.
rake rails_admin:install
rake db:migrate
In config/initializers/rails_admin.rb
:.
require "rails_admin/application_controller"
module RailsAdmin
class ApplicationController < ::ApplicationController
before_filter :is_admin?
private
def is_admin?
if current_user.nil? || !current_user.admin?
head(:forbidden)
false
end
end
end
end
I'm getting the following error:
ActionView::Template::Error (Could not find a valid mapping for # From here
6: - if _current_user
7: - if user_link = edit_user_link
8: %li= user_link
9: - if logout_path.present?
10: %li= link_to content_tag('span', t('admin.misc.log_out'), :class => 'label label-important'), logout_path, :method => Devise.sign_out_via
11: - if _current_user.respond_to?(:email) && _current_user.email.present?
12: %li= image_tag "#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", :style => 'padding-top:5px'
devise (2.2.3) lib/devise/mapping.rb:42:in find_scope!'
/home/eugene/.bundler/ruby/1.9.1/rails_admin-75079da0906e/app/helpers/rails_admin/application_helper.rb:36:inlogout_path'
Any help would be appreciated!
Thanks!