binarylogic-searchlogic 2.1.6 → 2.1.7
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.
- data/CHANGELOG.rdoc +4 -0
- data/VERSION.yml +1 -1
- data/lib/searchlogic/search.rb +2 -1
- data/searchlogic.gemspec +1 -1
- data/spec/search_spec.rb +7 -0
- data/spec/spec_helper.rb +3 -0
- metadata +1 -1
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
data/lib/searchlogic/search.rb
CHANGED
@@ -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
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
|
|