Skip to content

Commit 6f4dd05

Browse files
committed
Move logout_method to application helper and add fallback to delete if Devise is no present (need a Config for this).
1 parent 0c387fe commit 6f4dd05

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/helpers/rails_admin/application_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def logout_path
3939
end
4040
end
4141

42+
def logout_method
43+
return Devise.sign_out_via if defined?(Devise)
44+
:delete
45+
end
46+
4247
def wording_for(label, action = @action, abstract_model = @abstract_model, object = @object)
4348
model_config = abstract_model.try(:config)
4449
object = abstract_model && object.is_a?(abstract_model.model) ? object : nil

app/views/layouts/rails_admin/_secondary_navigation.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
- if user_link = edit_user_link
88
%li= user_link
99
- 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
10+
%li= link_to content_tag('span', t('admin.misc.log_out'), class: 'label label-important'), logout_path, method: logout_method
1111
- if _current_user.respond_to?(:email) && _current_user.email.present?
1212
%li= image_tag "#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", style: 'padding-top:5px'

0 commit comments

Comments
 (0)