class Rails::Generators::RespondersControllerGenerator

Protected Instance Methods

attributes_params() click to toggle source
# File lib/generators/rails/responders_controller_generator.rb, line 34
def attributes_params
  if strong_parameters_defined?
    "#{file_name}_params"
  else
    "params[:#{file_name}]"
  end
end
controller_before_filter() click to toggle source
# File lib/generators/rails/responders_controller_generator.rb, line 26
def controller_before_filter
  if ActionController::Base.respond_to?(:before_action)
    "before_action"
  else
    "before_filter"
  end
end
flash?() click to toggle source
# File lib/generators/rails/responders_controller_generator.rb, line 10
def flash?
  if defined?(ApplicationController)
    !ApplicationController.responder.ancestors.include?(Responders::FlashResponder)
  else
    Rails.application.config.responders.flash_keys.blank?
  end
end
orm_instance_update(params) click to toggle source
# File lib/generators/rails/responders_controller_generator.rb, line 18
def orm_instance_update(params)
  if orm_instance.respond_to?(:update)
    orm_instance.update params
  else
    orm_instance.update_attributes params
  end
end
strong_parameters_defined?() click to toggle source
# File lib/generators/rails/responders_controller_generator.rb, line 42
def strong_parameters_defined?
  defined?(ActionController::StrongParameters)
end