Reputation: 99
Do you know how we can param the root_path to display the first Post of the current user ?
Upvotes: 1
Views: 46
Reputation: 161
If you use Devise, you can use this function :
In your Application controller:
def after_sign_in_path_for(resource)
@post = current_user.posts.first
request.env['omniauth.origin'] || post_path(@post)
end
It's gonna redirect the user to his first post show
Upvotes: 1