Skip to content

Instantly share code, notes, and snippets.

@spurton
Created June 11, 2013 21:00
Show Gist options
  • Save spurton/5760638 to your computer and use it in GitHub Desktop.
Save spurton/5760638 to your computer and use it in GitHub Desktop.
Strong parameters fix
require 'rocket_pants/errors'
module RocketPants
class Base < ActionController::Metal
abstract!
MODULES = [
ActionController::HideActions,
ActionController::UrlFor,
ActionController::Redirecting,
ActionController::ConditionalGet,
ActionController::RackDelegation,
ActionController::RecordIdentifier,
ActionController::HttpAuthentication::Basic::ControllerMethods,
ActionController::HttpAuthentication::Digest::ControllerMethods,
ActionController::HttpAuthentication::Token::ControllerMethods,
ActionController::StrongParameters,
UrlFor,
Respondable,
HeaderMetadata,
Linking,
Versioning,
Instrumentation,
Caching,
# Include earliest as possible in the request.
AbstractController::Callbacks,
ActionController::Rescue,
ErrorHandling,
Rescuable,
JSONP
# FormatVerification # TODO: Implement Format Verification
].compact
# If possible, include the Rails controller methods in Airbrake to make it useful.
begin
require 'airbrake'
require 'airbrake/rails/controller_methods'
MODULES << Airbrake::Rails::ControllerMethods
rescue LoadError => e
end
MODULES.each do |mixin|
include mixin
end
# Bug fix for rails - include compatibility.
config_accessor :protected_instance_variables
self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render
@variables_added @request_origin @url @parent_controller @action_name
@before_filter_chain_aborted @_headers @_params @_response)
ActiveSupport.run_load_hooks(:rocket_pants, self)
# Methods for integration purposes.
def self.helper_method(*); end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment