binarylogic-searchlogic 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 2.1.7
2
+
3
+ * Add support for time zones in the Search class when type casting to Time objects.
4
+
1
5
  == 2.1.6 released 2009-07-13
2
6
 
3
7
  * Fix bug when trying to set conditions on conflicting column names with associations. Ex: User.has_many :orders, User.order_count_gt(10) would raise an exception because it was trying to set conditions on the count column for the orders table.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 1
4
- :patch: 6
4
+ :patch: 7
@@ -143,7 +143,8 @@ module Searchlogic
143
143
  # with the other models.
144
144
  column_for_type_cast = ActiveRecord::ConnectionAdapters::Column.new("", nil)
145
145
  column_for_type_cast.instance_variable_set(:@type, type)
146
- column_for_type_cast.type_cast(value)
146
+ value = column_for_type_cast.type_cast(value)
147
+ Time.zone && value.is_a?(Time) ? value.in_time_zone : value
147
148
  end
148
149
  end
149
150
  end
data/searchlogic.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{searchlogic}
5
- s.version = "2.1.6"
5
+ s.version = "2.1.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Johnson of Binary Logic"]
data/spec/search_spec.rb CHANGED
@@ -226,6 +226,13 @@ describe "Search" do
226
226
  search.created_at_after.should == Time.parse("Jan 1, 2009 9:33AM")
227
227
  end
228
228
 
229
+ it "should convert the time to the current zone" do
230
+ search = Order.search
231
+ now = Time.now
232
+ search.created_at_after = now
233
+ search.created_at_after.should == now.in_time_zone
234
+ end
235
+
229
236
  it "should be an Array and cast it's values given ['1', '2', '3']" do
230
237
  search = Order.search
231
238
  search.id_equals_any = ["1", "2", "3"]
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,9 @@ require 'rubygems'
3
3
  require 'ruby-debug'
4
4
  require 'activerecord'
5
5
 
6
+ ENV['TZ'] = 'UTC'
7
+ Time.zone = 'Eastern Time (US & Canada)'
8
+
6
9
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
7
10
  ActiveRecord::Base.configurations = true
8
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binarylogic-searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic