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 | |
TOKEN_PLACEHOLDER = "__CROSS_SITE_REQUEST_FORGERY_PROTECTION_TOKEN__" | |
after_filter :inject_csrf_token | |
private | |
def inject_csrf_token | |
if protect_against_forgery? && token = session['_csrf_token'] | |
if body_with_token = response.body.gsub!(TOKEN_PLACEHOLDER, token) |
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 Test::Unit::TestCase | |
# Assert that the model accepts nested attributes for the given +associations+ | |
# | |
# Example: | |
# should_accept_nested_attributes_for :orders | |
# | |
def self.should_accept_nested_attributes_for(*associations) | |
associations.each do |association| | |
should "accept nested attributes for #{association}" do |