Flash [:notice]无法使用Mercury Editor身份验证

时间:2015-09-05 02:10:03

标签: ruby-on-rails ruby-on-rails-4 authentication devise mercury-editor

在我的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合作!

感谢您的任何意见!

0 个答案:

没有答案