Hello,
I have the following in my controller to display a calendar using
calendar helper:
if not request.post?
@year = Time.now.year
@month = Time.now.month
else
@year = Date.new(params[:date][:year], Time.now.month.to_s,
Time.now.mday.to_s).year # this is line 154
@month = Date.new(Time.now.year.to_s,params[:date][:month],
Time.now.mday.to_s).month
end
This is what I have in the corresponding view:
<h1>Ship Calendar</h1>
<%= start_form_tag %>
<%= select_month(Date.today)%>
<%= select_year(Date.today)%>
<%= submit_tag ''Go'' %>
<%= end_form_tag %>
<%calendar({:year => @year, :month => @month}) do |d|
cell_text = "#{d.mday}<br />"
cell_attrs = {:class => ''day''}
@sales_orders.each do |o|
if o.ship_date.month == d.month
if o.ship_date.mday == d.mday
cell_text << link_to( o.id.to_s, :controller =>
''sales_orders'', :action => ''show'', :id
=> o ) << "<br />"
cell_attrs[:class] = ''specialDay''
end
end
end
[cell_text, cell_attrs]
end
%>
I can view the calendar initially, since it defaults to the current
month. But when I change the select box''s month and submit it, I get
the following error:
comparison of String with 0 failed
#{RAILS_ROOT}/app/controllers/histories_controller.rb:154:in
`history_calendar''
What am I doing wrong? I''m just trying to be able to switch to
different months for the calendar.
Thanks,
Jason
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---