Presentation: Ruby On Rails Basics
Yesterday, I had an opportunity to explain ruby on rails basics to trainees at VinSol. Below is the presentation which I gave which may be helpful to anyone out there trying to learn and understand rails.
Yesterday, I had an opportunity to explain ruby on rails basics to trainees at VinSol. Below is the presentation which I gave which may be helpful to anyone out there trying to learn and understand rails.
The DHTML / JavaScript Calendar is a javascript library for creating customized calendars. The library has been ported as a rails plugin, dhtml calendar.
Using calendar_select from this plugin, I found that the date time fields were not being updated after I picked up a date from date select popup. I had to modify lines 27-35 in calendar.rb from
if show_field == :select
input_field_year_id = "#{object}[#{method}(1i)]"
input_field_month_id = "#{object}[#{method}(2i)]"
input_field_day_id = "#{object}[#{method}(3i)]"
if calendar_options.has_key?(:showsTime) and calendar_options[:showsTime]
input_field_hour_id = "#{object}[#{method}(4i)]"
input_field_minute_id = "#{object}[#{method}(5i)]"
end
end
to
if show_field == :select
input_field_year_id = "#{object}_#{method}_1i"
input_field_month_id = "#{object}_#{method}_2i"
input_field_day_id = "#{object}_#{method}_3i"
if calendar_options.has_key?(:showsTime) and calendar_options[:showsTime]
input_field_hour_id = "#{object}_#{method}_4i"
input_field_minute_id = "#{object}_#{method}_5i"
end
end
The plugin internally uses datetime_select and date_select to create year select with DOM id as “#{object}_#{method}_1i” and DOM name as “#{object}[#{method}(1i)]“. The DOM name variable was been referenced in the calendar.rb which did not update the fields when user tries to pick a date from popup. On changing this to DOM id variable, everything worked fine.
Going so soon? May these links be a guide to web enlightenment.