app/helpers/carload/application_helper.rb in carload-0.1.0 vs app/helpers/carload/application_helper.rb in carload-0.2.0
- old
+ new
@@ -1,4 +1,15 @@
module Carload
module ApplicationHelper
+ def needs_upload? model_name, attribute_name
+ case Carload.upload_solution
+ when :carrierwave
+ model_class = model_name.to_s.classify.constantize
+ not model_class.instance_methods.map(&:to_s).select { |x| x =~ /#{attribute_name}_url/ }.empty?
+ end
+ end
+
+ def image? attribute_name
+ attribute_name.to_s =~ /image|logo|img/
+ end
end
end