Wordica
Wordica

Reputation: 2595

Rails with activeadmin and devise - signed_in?

I have installed devise and activeadmin. When i login to activeadmin rails thinks that im also signed_in as a user on page but with no current_user value. When i go on some pages without login as user (with logged on activeadmin) statement:

<% if signed_in? %> 

is true and rails try to run script in it. How can i tell rails that activeadmin users isnt current_user for whole site?

Upvotes: 1

Views: 1716

Answers (1)

NicoArbogast
NicoArbogast

Reputation: 413

You should tell the signed_in? method which user to look at:

on regular user pages where you do not want to be considered as signed in when you're signed in as an admin, you may want to replace

    <% if signed_in? %> 

by

    <% if user_signed_in? %> 

where user is the name of your Devise resource (if you have named it differently, replace user by the actual name (ex: if your Devise user model is EndUser, your should put end_user_signed_in?)

Upvotes: 4

Related Questions