lib/action_controller/permittance.rb
def permitter_class
      # Permitters should be in the same namespace as the controller, like ActiveModel::Serializers are in the same namespace as the model.
      name = self.class.name
      # in Rails 3.2+ could do:
      # namespace = name.deconstantize; "#{namespace}#{namespace.blank? ? '' : '::'}#{name.demodulize.chomp('Controller').singularize}Permitter".constantize
      # Rails < 3.2
      last_index = name.rindex('::')
      "#{last_index ? "#{name[0...(last_index || 0)]}::" : ''}#{(last_index ? name[(last_index+2)..-1] : name).chomp('Controller').singularize}Permitter".constantize
    end
# Returns the permitter class corresponding to the controller by matching everything in the controller class name
# other than "Controller" and singularizing the part after any namespace before tacking on Permitter to the name.
#
# e.g. if self.class.name is "A:B:StatusesController", it would return A::B::StatusPermitter
Returns the permitter class corresponding to the controller by matching everything in the controller class name
other than "Controller" and singularizing the part after any namespace before tacking on Permitter to the name.


Returns the permitter class corresponding to the controller by matching everything in the controller class name other than " Controller " and singularizing the part after any namespace before tacking on Permitter to the name .
def permitter_class
      name = self.class.name
      last_index = name.rindex('::')
      "#{last_index ? "#{name[0...(last_index || 0)]}::" : ''}#{(last_index ? name[(last_index+2)..-1] : name).chomp('Controller').singularize}Permitter".constantize
    end
def permitter_class name = self . class . name last_index = name . rindex ( '::' ) "#{last_index ? "#{name[0...(last_index || 0)]}::" : ''}#{(last_index ? name[(last_index+2)..-1] : name).chomp('Controller').singularize}Permitter" . constantize end
Returns the permitter class corresponding to the controller by matching everything in the controller class name
other than "Controller" and singularizing the part after any namespace before tacking on Permitter to the name.
Returns the permitter class corresponding to the controller by matching everything in the controller class name other than " Controller " and singularizing the part after any namespace before tacking on Permitter to the name .
# Permitters should be in the same namespace as the controller, like ActiveModel::Serializers are in the same namespace as the model. # in Rails 3.2+ could do: # namespace = name.deconstantize; "#{namespace}#{namespace.blank? ? '' : '::'}#{name.demodulize.chomp('Controller').singularize}Permitter".constantize # Rails < 3.2