module Padrino::Responders::Helpers::ControllerHelpers

Protected Instance Methods

action_name() click to toggle source

Returns name of current action

# File lib/padrino-responders/helpers/controller_helpers.rb, line 16
def action_name
  name = request.match.route.instance_variable_get('@name').to_s
  name.gsub!(/^#{controller_name}_?/, '')
  name = 'index' if name == ''
  name
end
controller_name() click to toggle source

Returns name of current controller

# File lib/padrino-responders/helpers/controller_helpers.rb, line 68
def controller_name
  request.match.route.controller.to_s
end
human_model_name(object) click to toggle source

Returns translated, human readable name for specified model.

# File lib/padrino-responders/helpers/controller_helpers.rb, line 75
def human_model_name(object)
  if object.class.respond_to?(:human_name)
    object.class.human_name 
  else
    t("models.#{object.class.to_s.underscore}", :default => object.class.to_s.humanize)
  end 
end
notify(kind, message, *args, &block) click to toggle source

Shortcut for notifier.say method.

# File lib/padrino-responders/helpers/controller_helpers.rb, line 9
def notify(kind, message, *args, &block)
  self.class.notifier.say(self, kind, message, *args, &block)
end