Ruby on Rails Wednesday, February 25, 2015

Colin Law wrote in post #1168627:
> I have responded to this in the earlier thread where you asked it the
> first time.
>
> Colin

i am working on the existing code,i am new to ruby on rails ,i am not
understanding this code and how is it working.why is 0..-6 given in
month and 3...8 in year.

<% 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 %>

--
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/ab1736a906078607af4a4661d8a31e6b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment