lit 0.2.0 → 0.2.1

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.
@@ -32,9 +32,11 @@ module Lit
32
32
 
33
33
  def clear_params
34
34
  if defined?(::ActionController::StrongParameters)
35
- params.require(:localization).permit(:translated_value, :locale_id)
35
+ clear_params = params.require(:localization).permit(:translated_value, :locale_id)
36
+ clear_params.merge! params.require(:localization).permit(:translated_value => []) # allow translated_value to be an array
37
+ clear_params
36
38
  else
37
- params[:localization]
39
+ params[:localization].is_a?(Hash) ? params[:localization].slice(:translated_value, :locale_id) : {}
38
40
  end
39
41
  end
40
42
  end
@@ -70,13 +70,21 @@ module Lit
70
70
  else
71
71
  s = s.ordered
72
72
  end
73
+ localization_key_col = Lit::LocalizationKey.arel_table[:localization_key]
74
+ default_value_col = Lit::Localization.arel_table[:default_value]
75
+ translated_value_col = Lit::Localization.arel_table[:translated_value]
73
76
  if options[:key_prefix].present?
74
77
  q = "#{options[:key_prefix]}%"
75
- s = s.where('lit_localization_keys.localization_key like ?', q)
78
+ s = s.where(localization_key_col.matches(q))
76
79
  end
77
80
  if options[:key].present?
78
81
  q = "%#{options[:key]}%"
79
- s = s.joins([:localizations]).where('lit_localization_keys.localization_key like ? or lit_localizations.default_value like ? or lit_localizations.translated_value like ?', q, q, q)
82
+ cond = localization_key_col.matches(q).or(
83
+ default_value_col.matches(q).or(
84
+ translated_value_col.matches(q)
85
+ )
86
+ )
87
+ s = s.joins([:localizations]).where(cond)
80
88
  end
81
89
  if not options[:include_completed].to_i==1
82
90
  s = s.not_completed
data/lib/lit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lit
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-11 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails