Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange error blocks users from editing devise profile
    primarykey
    data
    text
    <p>I have an application under development in Rails 3.2.13 with devise, omniauth and cancan. It all worked perfectly until I started to implement authorisation with cancan. It is even more interesting that cancan itself works like charm but generates an error in editing the user profile provided by devise. If cancan does that at all, I'm really not sure.</p> <p>The error message is:</p> <pre><code>No route matches {:controller=&gt;"devise/posts"} </code></pre> <p>I have a posts controller, but that's not linked to devise by any means. This is the strangest part in the story.</p> <p>I successfully localised the spot that generates it but I can't figure out what the cause of the problem is and how to fix it. So I have a menu shown only to admins in my <code>application.html.erb</code> , this is the source:</p> <pre><code>&lt;% if (user_signed_in? &amp;&amp; (current_user.role?("sysadmin") || current_user.role?("postadmin") || current_user.role?("testadmin"))) %&gt; &lt;ul class="nav navbar-nav nav-pills"&gt; &lt;li class="dropdown"&gt; &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color: crimson;"&gt; &lt;span class="glyphicon glyphicon-cog"&gt;&lt;/span&gt; Administration &lt;b class="caret"&gt;&lt;/b&gt;&lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;% if (current_user.role?("sysadmin") || current_user.role?("postadmin")) then %&gt; &lt;li&gt;&lt;%= link_to 'Posts', :controller =&gt; :posts, :action =&gt; :index %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;% if (current_user.role?("sysadmin") || current_user.role?("testadmin")) then %&gt; &lt;li&gt;&lt;%= link_to 'Itests', :controller =&gt; :itests, :action =&gt; :index %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;% end %&gt; </code></pre> <p>What's really interesting is that if I delete the <code>&lt;ul&gt;...&lt;/ul&gt;</code> block so to leave nothing but a naked <code>if ... end</code> block, it works. Also, it works for users not having any of the three admin roles.</p> <p>But in the <code>&lt;ul&gt;...&lt;/ul&gt;</code> block there's nothing else but HTML, Bootstrap styling and some inline ruby links to some other controllers. </p> <p>How does this breaks the "edit profile" feature of devise?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload