Various changes since last time, such as adding user login authentication, with the following in the User model, which seems to mimic the WordPress authentication (at least for my password):
Thanks to Aaron Hill for a helpful post on that topic.
Biggest change has been the introduction of permalinks, and making it possible to view each blog post on a separate page. Within the Post model, I added the following:
Thanks to the author of this snippet for some of that.
Then in routes.rb
, I have:
This preserves mydomain.com/posts
and mydomain.com/posts/new
URLs for listing and creating posts, but allows mydomain.com/2013/09/04/my-post
as a permalink for the post itself (allowing lower-case letters, numbers, hyphens and underscores).
(I’ll leave the smileys in, just to show how clever WordPress is…)
Finally, within PostsController
, replace all the Post.find
occurrences with Post.find_by_permalink
, and I think that’s all!