templus_models 2.0.16 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,32 +0,0 @@
1
- module AttributesHelper
2
-
3
- def association?(model, attribute)
4
- !!model.reflect_on_association(attribute)
5
- end
6
-
7
- def belongs_to_association?(model, attribute)
8
- association_type?(model, attribute, :belongs_to)
9
- end
10
-
11
- def has_one_association?(model, attribute)
12
- association_type?(model, attribute, :has_one)
13
- end
14
-
15
- def array?(record, attribute)
16
- attribute_class?(record, attribute, Array)
17
- end
18
-
19
- def boolean?(record, attribute)
20
- ['false', 'true'].include? record.send(attribute).to_s
21
- end
22
-
23
- private
24
-
25
- def association_type?(model, attribute, association_type)
26
- association?(model, attribute) && model.reflect_on_association(attribute).macro == association_type
27
- end
28
-
29
- def attribute_class?(record, attribute, klass)
30
- record.send(attribute).class == klass
31
- end
32
- end
@@ -1,15 +0,0 @@
1
- module ImagensHelper
2
-
3
- def carrier_wave_uploader?(model, attribute)
4
- model.new.send(attribute).class.ancestors.include?(CarrierWave::Uploader::Base)
5
- end
6
-
7
- def possui_url?(record, attribute)
8
- record.send(attribute).respond_to?(:url)
9
- end
10
-
11
- def deve_renderizar_imagem?(opts)
12
- opts.has_key?(:render) && !!opts[:render]
13
- end
14
-
15
- end