On Friday, February 6, 2015 at 7:09:52 AM UTC, Ruby-Forum.com User wrote:
> i am try to change existing code,i am not unserstanding code,it is
> written for blog archive clicking on each month and year in right column
> it should redirect to that clicked month.by the  below code only few are
> working not all months,december is giving invalid date error

The confusing bit for me in the below code is monthname - its clearly not the 
name of the month because it's used both as an index into an array of month 
names and to extract year information - what does it contain?

What happens precisely when you click on December (what parameters are sent 
with the request and what is the code that raises an exception?)

Fred


>        div class="right-col">
>       <h2>ARCHIVES</h2>
>       <div class='posts_by_month'>
> 
>         <ul>
>         <% archive_string = "" %>
>         <% date_value = "" %>
>       <% @posts_by_month.each do |monthname,                posts| %>
> 
>           <% date_value = (Date::MONTHNAMES[monthname[0..-6].to_i]) + "
> " + (monthname[3..8]) %>
>           <% archive_string = "<li><a class='filter' href='/blog?month="
> + monthname[0..-6] + "&year=" + monthname[3..8] + "'>" + date_value +
> "</a></li>" + archive_string %>
>         <% end %>
>         <%= raw archive_string %>
>         </ul>
> 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5e15766d-b1ff-4fa8-a23c-ec9744e023d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to