This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>TwitterBootstrapPoc</title> | |
<%= stylesheet_link_tag "application", :media => "all" %> | |
<%= javascript_include_tag "application" %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<div class="twitter-flash"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserController < ApplicationController | |
def show | |
flash[:error] = "User ID: #{params[:id]}did not exist" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<% flash.each do |name, msg| -%> | |
<%= content_tag :div, msg, class: name %> | |
<% end -%> | |
<%= yield %> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BootstrapFlashHelperPatched | |
ALERT_TYPES = [:error, :info, :success, :warning] unless const_defined?(:ALERT_TYPES) | |
def bootstrap_flash_patched | |
flash_messages = [] | |
flash.each do |type, message| | |
# Skip empty messages, e.g. for devise messages set to nothing in a locale file. | |
next if message.blank? | |
type = type.to_sym |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BootstrapFlashHelperPatched | |
ALERT_TYPES = [:error, :info, :success, :warning] unless const_defined?(:ALERT_TYPES) | |
def bootstrap_flash_patched | |
flash_messages = [] | |
flash.each do |type, message| | |
# Skip empty messages, e.g. for devise messages set to nothing in a locale file. | |
next if message.blank? | |
type = type.to_sym |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> | |
%3E | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
ensure_authorization_performed :except => [:index, :search], :if => :auditing_security?, :unless => :devise_controller? | |
private | |
def auditing_security? | |
Rails.env != 'production' | |
end | |
# Send 'em back where they came from with a slap on the wrist | |
def authority_forbidden(error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def verify_authenticity_token | |
unless verified_request? | |
logger.warn "WARNING: Can't verify CSRF token authenticity" if logger | |
handle_unverified_request | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reset_session | |
session.destroy if session && session.respond_to?(:destroy) | |
self.session = {} | |
@env['action_dispatch.request.flash_hash'] = nil | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
# Overload handle_unverified_request to ensure that | |
# exception is raised each time a request does not | |
# pass validation. | |
def handle_unverified_request | |
raise(ActionController::InvalidAuthenticityToken) | |
end | |
end |
OlderNewer