module ControllerCommands::Command
Public Class Methods
included(base)
click to toggle source
# File lib/controller_commands/command.rb, line 44 def self.included(base) base.extend(ClassMethods) end
new(incoming_params, context)
click to toggle source
# File lib/controller_commands/command.rb, line 48 def initialize(incoming_params, context) @incoming_params = incoming_params @context = context end
Public Instance Methods
errors()
click to toggle source
# File lib/controller_commands/command.rb, line 57 def errors @result.messages end
perform()
click to toggle source
# File lib/controller_commands/command.rb, line 74 def perform self.class.perform(@context, validated_params) end
render_success(output)
click to toggle source
# File lib/controller_commands/command.rb, line 78 def render_success(output) self.class.execute_before_success_render(@context, output) end
success_message()
click to toggle source
# File lib/controller_commands/command.rb, line 70 def success_message self.class.get_success_message end
validate_params()
click to toggle source
# File lib/controller_commands/command.rb, line 65 def validate_params @result = self.class.validate(@context, @incoming_params) @result.messages.count == 0 end
validated?()
click to toggle source
# File lib/controller_commands/command.rb, line 53 def validated? !!@result end
validated_params()
click to toggle source
# File lib/controller_commands/command.rb, line 61 def validated_params @result.output end