c_doug
(c_doug)
1
I am trying to make a blog archive by month. Can someone please tell me
how to make these @params match the date format that is being passed.
I am passing the url: /posts?month=August
@month = @params['created']
(created is a field in the database populated with datetime stamps)
There is no error, it just doesn't filter by month. I am having trouble
finding any helpful info.
Hi Casey,
In the snippet you gave, it doesn't looked like there will be a params[:created], unless your routes.rb file slaps one in there. Try params[:month]
(You probably want to move away from "@params" and toward "params"; see Ruby on Rails — Use params, not @params).
c_doug
(c_doug)
3
I need to learn the basics of params. I tried the above code by
modifying:
@category = @params['category']
that actually works.
I have been told about params [:month] but assumed it had to reference
the 'created' field formatted as a month to compare to what was passed.
c_doug
(c_doug)
4
Can anyone please help to explain my last question?