Ruby on Rails Thursday, February 5, 2015

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
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a36c0a984b0fd42040cb8898e58a9029%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment