Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

patch applied to fix issue #92: nil object option causes CalendarDate…

…Select.calendar_date_select(object, method, options) to not use object. Thanks, sskirby!
  • Loading branch information...
commit 9baa458f88fca34d8e4762317f02590fca3c91fe 1 parent 7c39ee6
@timcharper authored
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+== Version 1.10.4 ==
+Mar 24, 2008
+ * patch applied to fix issue #92: nil object option causes CalendarDateSelect.calendar_date_select(object, method, options) to not use object. Thanks, sskirby!
+
== Version 1.10.3 ==
Mar 24. 2008
* Fixed active scaffold integration bug. Thanks tapajos!
View
2  lib/calendar_date_select.rb
@@ -139,7 +139,7 @@ def calendar_date_select_process_options(options)
end
def calendar_date_select(object, method, options={})
- obj = options.include?(:object) ? options[:object] : instance_eval("@#{object}")
+ obj = options[:object] || instance_variable_get("@#{object}")
if !options.include?(:time) && obj.class.respond_to?("columns_hash")
column_type = (obj.class.columns_hash[method.to_s].type rescue nil)
View
8 test/functional/calendar_date_select_test.rb
@@ -145,5 +145,13 @@ def test__tag__formats_text_correctly_time_with_format
assert_no_match(/12:01 AM/, output, "Should not have outputted a time")
assert_match('2007-01-02', output, "Should have outputted a correctly formatted time")
end
+
+ def test__nil_object_option__should_disregard
+ @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
+ output = calendar_date_select(:model, :start_datetime, :time => true, :object => nil)
+ assert_match(CalendarDateSelect.format_date(@model.start_datetime), output, "Should have outputted a time")
+ end
end
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.