Sort_link_helper , sorting on date

I am using this helper to sort my table colums, no problem sorting on
string but how can I sort a date colum ( in my DB, )

user_helper.rb ----------------------
def sort_link_helper(text, param)
key = param
key += “_reverse” if @params[:sort] == param
options = {
:url => {:action => ‘list’, :params => @params.merge({:sort =>
key, :page => nil})},
:update => ‘table’,
:before => “Element.show(‘spinner’)”,
:success => “Element.hide(‘spinner’)”
}
html_options = {
:title => “Sort by this field”,
:href => url_for(:action => ‘list’, :params => @params.merge({:sort
=> key, :page => nil}))
}
link_to_remote(text, options, html_options)
end

_user_list.rhtml ----------------------- (partial in my list.rhtml)

><%= sort_link_helper "Start", "startdate"> .... table item line ----------- <%= h(booking.startdate.loc("%a %d %b")) %>

I am using paginate in my controller with the sort parameter
user_controller.rb ----------
def list
@bookings = paginate(:bookings, :order => sort,…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs