1

In my lib/mercury/authentication.rb file I have

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 

And 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 %>

Yet the 'notice' never appears, even though it is working with Devise!

Thanks for any input!

James L.
  • 12,893
  • 4
  • 49
  • 60

0 Answers0