简体   繁体   中英

Looping posts in devise signup/signin view (Rails)

I want to loop all the posts all users have created within the devise signup and sign in views. Not sure where to paste @posts = Post.all.order("created_at desc") at.

You can generate the controllers Devise uses by running:

rails generate devise:controllers

This will make all its controllers readily available for editing. Then in your sessions/new action (sign in page ) you can add that @posts line. And Registrations/new would be your sign up page. It's in the Devise Documentation under "Configuring Devise Controllers".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM