Module: Formtastic::Helpers::FileColumnDetection

Included in:
ErrorsHelper, InputHelper
Defined in:
lib/formtastic/helpers/file_column_detection.rb

Instance Method Summary collapse

Instance Method Details

#is_file?(method, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/formtastic/helpers/file_column_detection.rb', line 6

def is_file?(method, options = {})
  @files ||= {}
  @files[method] ||= (options[:as].present? && options[:as] == :file) || begin
    file = @object.send(method) if @object && @object.respond_to?(method)
    file && file_methods.any?{|m| file.respond_to?(m)}
  end
end