public
Rubygem
Description: A popular and flexible JavaScript DatePicker for RubyOnRails (and others)
Homepage: http://code.google.com/p/calendardateselect/
Clone URL: git://github.com/timcharper/calendar_date_select.git
patch applied to fix issue #92: nil object option causes 
CalendarDateSelect.calendar_date_select(object, method, options) to not 
use object.  Thanks, sskirby!
timcharper (author)
Mon Mar 24 09:13:11 -0700 2008
commit  9baa458f88fca34d8e4762317f02590fca3c91fe
tree    c8a6c572da35866772b223420957eab327b74eda
parent  7c39ee62b1bda859147f8abf19e895935830a241
...
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
0
@@ -1,3 +1,7 @@
0
+== Version 1.10.4 ==
0
+Mar 24, 2008
0
+ * patch applied to fix issue #92: nil object option causes CalendarDateSelect.calendar_date_select(object, method, options) to not use object. Thanks, sskirby!
0
+
0
 == Version 1.10.3 ==
0
 Mar 24. 2008
0
  * Fixed active scaffold integration bug. Thanks tapajos!
...
139
140
141
142
 
143
144
145
...
139
140
141
 
142
143
144
145
0
@@ -139,7 +139,7 @@ class CalendarDateSelect
0
     end
0
     
0
     def calendar_date_select(object, method, options={})
0
- obj = options.include?(:object) ? options[:object] : instance_eval("@#{object}")
0
+ obj = options[:object] || instance_variable_get("@#{object}")
0
       
0
       if !options.include?(:time) && obj.class.respond_to?("columns_hash")
0
         column_type = (obj.class.columns_hash[method.to_s].type rescue nil)
...
145
146
147
 
 
 
 
 
 
148
149
 
 
...
145
146
147
148
149
150
151
152
153
154
155
156
157
0
@@ -145,5 +145,13 @@ class HelperMethodsTest < Test::Unit::TestCase
0
     assert_no_match(/12:01 AM/, output, "Should not have outputted a time")
0
     assert_match('2007-01-02', output, "Should have outputted a correctly formatted time")
0
   end
0
+
0
+ def test__nil_object_option__should_disregard
0
+ @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
0
+ output = calendar_date_select(:model, :start_datetime, :time => true, :object => nil)
0
+ assert_match(CalendarDateSelect.format_date(@model.start_datetime), output, "Should have outputted a time")
0
+ end
0
 
0
 end
0
+
0
+

Comments

    No one has commented yet.