module ObjectsFramework::FormHelper

Public Class Methods

new() click to toggle source
# File lib/objectsframework/formhelper.rb, line 3
def initialize
        @form_helper_errors = []
end

Public Instance Methods

params_present?(*fields) click to toggle source
# File lib/objectsframework/formhelper.rb, line 7
def params_present?(*fields)
        test_is_not_failed = true
        fields.each do |field|
                if(!respond_to?(field))
                        @form_helper_errors << {field: field, message: "Required field", status: "fieldnotfound"}
                        test_is_not_failed = false
                elsif(send(field).empty?)
                        @form_helper_errors << {field: field, message: "Required field", status: "emptyfield"}
                        test_is_not_failed = false
                end
        end
        return test_is_not_failed
end