Often, when signing up for a new platform, you are asked to select from a list of items in order to see posts that relate to your interests. Some of the sites employing this technique are Quora, Medium and pinterest just to name a few. This is a screenshot from quora right after signing up.
In this tutorial, we are going to implement this feature on a normal blog. In the first part, we will create posts and tag them. Later on, we will add user authentication and let users select their interests. Here is a working demo. The complete code can be found on github.
Let's start by creating a new rails app. I am using rails 4.2 in this tutorial:
rails new curated-feed
The Blog
Now let's create a Posts controller and a post model, respectively:
rails g controller Posts index feed new edit show
rails g model Posts title:string description:text
rake db:migrate
The posts we'll be creating are pretty basic, having just a title and a description. Let's add a posts resource so we can get all the routes to perform CRUD operations on posts. We'll also change our root_path to point to the index action of the PostsController:
Continue reading %Tap User Interests with Curated Feeds in Rails%
by Christopher Vundi via SitePoint
No comments:
Post a Comment