forest_liana 1.5.10 → 1.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 140da6cdc3170f48772f2bec03654ccd3538dec1
4
- data.tar.gz: f9be7f154d6b0d2e90c43c8cec833711405f4fc4
3
+ metadata.gz: 9574e613f6f1afd99b25965e0745041cbaac82d7
4
+ data.tar.gz: c28a317cc3f85b4af970fbf7d0b5659c57ab7327
5
5
  SHA512:
6
- metadata.gz: 7f70948a98ca188dec096776f6bef958be2ffbefbeb7e07b73b1905a6a566724e032c24116bb0ef0a8ff0c581f0ee531c46cd16203c795270345615443450304
7
- data.tar.gz: caca9e9de5a19d86d0f3939348b64016438ab5bd14449bfd3037cd2da027b41e778eb8cce0bd9cccd080e4ebc57ff80223760689036286459e8dcf27c1a3aace
6
+ metadata.gz: 6e6a8bea49321d364e59b3900dceeff7c30b94e60e7d4df314e59746a8575ab7fc7c596aa6eb6f2686f3303942f6378087728cb0dcb3f91de46191c0e49ff13c
7
+ data.tar.gz: 7c6e55d47cb9ab5d4b4c33c8f5b82eac116fe0aba36ca6c0f9430e25968b3365f9bc370b49da9ce2dc7ba58aa0c25e7c9d80d4ec176832822c5d1a7b3e4ca054
@@ -5,5 +5,13 @@ module ForestLiana
5
5
  quoted_column_name = ActiveRecord::Base.connection.quote_column_name(column_name)
6
6
  "#{quoted_table_name}.#{quoted_column_name}"
7
7
  end
8
+
9
+ def self.cast_boolean(value)
10
+ if ActiveRecord::Base.connection.adapter_name == 'MySQL'
11
+ value === 'true' ? 1 : 0;
12
+ else
13
+ value
14
+ end
15
+ end
8
16
  end
9
17
  end
@@ -30,7 +30,7 @@ module ForestLiana
30
30
  private
31
31
 
32
32
  def collection
33
- @params[:collection].singularize.capitalize.constantize
33
+ @params[:collection].singularize.camelize.constantize
34
34
  end
35
35
  end
36
36
  end
@@ -41,7 +41,7 @@ module ForestLiana
41
41
  private
42
42
 
43
43
  def collection
44
- @params[:collection].singularize.capitalize.constantize
44
+ @params[:collection].singularize.camelize.constantize
45
45
  end
46
46
 
47
47
  def link(conversation)
@@ -49,7 +49,7 @@ module ForestLiana
49
49
  end
50
50
 
51
51
  where = "#{field_name} #{operator}"
52
- where += " '#{value}'" if value
52
+ where += " #{self.format_value(resource, field, value)}" if value
53
53
  where
54
54
  end
55
55
  end
@@ -65,5 +65,14 @@ module ForestLiana
65
65
  end
66
66
  end
67
67
 
68
+ def self.format_value(resource, field, value)
69
+ column = resource.columns.find { |c| c.name == field }
70
+ if column.type == :boolean
71
+ ForestLiana::AdapterHelper.cast_boolean(value)
72
+ else
73
+ "'#{value}'"
74
+ end
75
+ end
76
+
68
77
  end
69
78
  end
@@ -73,7 +73,7 @@ module ForestLiana
73
73
  end
74
74
 
75
75
  def collection
76
- @params[:collection].singularize.capitalize.constantize
76
+ @params[:collection].singularize.camelize.constantize
77
77
  end
78
78
 
79
79
  def field
@@ -73,7 +73,7 @@ module ForestLiana
73
73
  end
74
74
 
75
75
  def collection
76
- @params[:collection].singularize.capitalize.constantize
76
+ @params[:collection].singularize.camelize.constantize
77
77
  end
78
78
 
79
79
  def field
@@ -82,7 +82,7 @@ module ForestLiana
82
82
  end
83
83
 
84
84
  def collection
85
- @params[:collection].singularize.capitalize.constantize
85
+ @params[:collection].singularize.camelize.constantize
86
86
  end
87
87
 
88
88
  def field
@@ -80,7 +80,7 @@ module ForestLiana
80
80
  end
81
81
 
82
82
  def collection
83
- @params[:collection].singularize.capitalize.constantize
83
+ @params[:collection].singularize.camelize.constantize
84
84
  end
85
85
 
86
86
  def field
@@ -84,7 +84,7 @@ module ForestLiana
84
84
  end
85
85
 
86
86
  def collection
87
- @params[:collection].singularize.capitalize.constantize
87
+ @params[:collection].singularize.camelize.constantize
88
88
  end
89
89
 
90
90
  def field
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "1.5.10"
2
+ VERSION = "1.5.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails