I have installed devise and I can create users. I am trying to display all of the users so that people can see who has signed up. I would eventually like to allow people to send messages etc..(think Tinder).

Any guidance on displaying profiles to the user?

有帮助吗?

解决方案

This is big question to answer here and explain .I think you want to display listing of all the users and for every user there would be a profile page(show ). what you need to do is create controller having same name as devise name.I can give you small idea about that.

Class UsersController < ApplicationController 

def index
  @users = User.all
end

def show
  @user = User.find(params[:id])  //you can change it according to rails4 standards 
end
....
....
....


end 

with this you can display all user and display there profiles.

Now for messaging you need to create a different model Message and which will have fields sender,receiver and msg .both sender and receiver will be user_id ,sender you can get from session and receiver you can get from profile itself.and remember user can have many messages

But for making this real time you have to use web sockets which will be different question to answer.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top