1

私の lib/mercury/authentication.rb ファイルには

module Mercury
  module Authentication

    def can_edit?
      if user_signed_in? and current_user.role == 'admin'
        true
      else
        #flash[:notice] = "You are not authorized to view that page."
        redirect_to root_path, notice:"You are not authorized to view that page."
      end
    end

  end
end 

そして app/views/layouts/application.html.erb

<% if notice %>
  <p class="alert alert-success"><%= notice %></p>
<% end %>
<% if alert %>
  <p class="alert alert-danger"><%= alert %></p>
<% end %>

Deviseで動作しているにもかかわらず、「通知」は表示されません!

ご意見ありがとうございます。

4

0 に答える 0