backframe 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/backframe/activerecord/filter_sort.rb +8 -7
- data/lib/backframe/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2e1d68313054692fd5e4a0178cbca7e3fab5d51
|
4
|
+
data.tar.gz: 96d8a7dd3c7b631b5850da80c863ab9b8b334294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09af97fd6f9da753452b9d38339a6d71e40ea8362b9cbaa04960872196231cc0cd837412e069dc827a117f7c9bdada47689acb1d548f714ca27e8f2127f4966f
|
7
|
+
data.tar.gz: 77ea7a04fedbe0fa178c19b51bed8751bc73d4f0a552276b5871e677fc89b943c96e9adbbd7263249001c4c6e592f324e8c2173ca0679759e2678c1cfe410ba8
|
@@ -56,15 +56,16 @@ module Backframe
|
|
56
56
|
model_table = self.table_name
|
57
57
|
associations = self.reflect_on_all_associations(:belongs_to)
|
58
58
|
associations.each do |association|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
if !(association.options.key?(:polymorphic) && association.options[:polymorphic])
|
60
|
+
association_name = association.name
|
61
|
+
association_table = association.class_name.constantize.table_name
|
62
|
+
association_foreign_key = association.foreign_key
|
63
|
+
sortjoins["#{association.name}"] = "LEFT OUTER JOIN \"#{association_table}\" #{association_name} ON (\"#{association_name}\".\"id\" = \"#{model_table}\".\"#{association_foreign_key}\")"
|
64
|
+
association.class_name.constantize.columns.each do |column|
|
65
|
+
sortfields["#{association_name}.#{column.name}"] = "\"#{association_name}\".\"#{column.name}\""
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
|
-
|
68
69
|
key = (key.present? && sortfields.has_key?(key)) ? key : default_key
|
69
70
|
order = (order.present?) ? order : default_order
|
70
71
|
if parts = key.match(/(\w*)\.(\w*)/)
|
data/lib/backframe/version.rb
CHANGED