cowtech-rails 1.7.3.1 → 1.7.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -145,7 +145,7 @@ module Cowtech
145
145
  parameter = :search unless parameter
146
146
 
147
147
  self.crud_query_add_condition(data, "(#{self.crud_get_class(data).table_name}.#{self.crud_get_class(data).deleted_column} = :deleted)", {:deleted => false}) unless data[:skip_deleted]
148
-
148
+
149
149
  # GET QUERY
150
150
  args = params[parameter] unless args
151
151
 
@@ -155,7 +155,7 @@ module Cowtech
155
155
  # BUILD QUERY
156
156
  data[:query_params].merge!(parameters)
157
157
  search_query = []
158
- fields.each do |field| search_query << "(#{search.gsub("@FIELD@", field.to_s)})" end
158
+ fields.each do |field| search_query << "(#{search.gsub("@FIELD@", "#{self.crud_get_class(data).table_name}.#{field.to_s}")})" end
159
159
 
160
160
  # ADD OPTIONAL DATA
161
161
  if externals then
@@ -164,12 +164,12 @@ module Cowtech
164
164
 
165
165
  unless external[:manual] then
166
166
  external_conds = []
167
- external.fetch(:fields, []).each do |external_field| external_conds << "(#{search.gsub("@FIELD@", external_field.to_s)})" end
167
+ external.fetch(:fields, []).each do |external_field| external_conds << "(#{search.gsub("@FIELD@", "#{external[:table]}.#{external_field.to_s}")})" end
168
168
  external_field = external.fetch(:external_field, "id")
169
169
  external_query = "(#{external.fetch(:field, "id")} IN (SELECT #{external.fetch(:external_field, "id")} FROM #{external[:table]} WHERE #{external_conds.join(" OR ")}))"
170
170
  else
171
171
  external_conds = []
172
- external.fetch(:fields, []).each do |external_field| external_conds << "(#{search.gsub("@FIELD@", external_field.to_s)})" end
172
+ external.fetch(:fields, []).each do |external_field| external_conds << "(#{search.gsub("@FIELD@", "#{external[:table]}.#{external_field.to_s}")})" end
173
173
  external_query = external[:query].gsub("@SEARCH@", external_conds.join(" OR "))
174
174
  end
175
175
 
@@ -9,8 +9,8 @@ module Cowtech
9
9
  module Version
10
10
  MAJOR = 1
11
11
  MINOR = 7
12
- PATCH = 3
13
- BUILD = 1
12
+ PATCH = 4
13
+ BUILD = 0
14
14
 
15
15
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cowtech-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3.1
4
+ version: 1.7.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: