I'm creating a todo list in Rails and right now, I have the lists come up as their ID in the url, for example:
root/todo_lists/4
But as the application evolves, I am wanting to replace the ID system with a date system (since on the home page, there is a calendar, rather than a list of todo lists). So clicking on a day in the calendar, will take me to the post of that day.
Now the calendar is Rails simple_calendar and the individual links to the days are in YYYY-MM-DD format. This is fine. I know that when I create a todo list, I can get the same formatting with (for example):
TodoList.last.created_at.strftime("%Y-%m-%d")
Which outputs a date in the format, YYYY-MM-DD.
So I need to know how I can change the ID in the new list from 3, for example, to something like 2015-09-08.
I will try to figure out how to link from the simple_calendar to the post URL, but this is the first issues at the moment.
Aucun commentaire:
Enregistrer un commentaire