how to access the devise @user instance variable outside of the devise controller & templates

Sonny Black

So I have an app that has user profiles, now bare in mind the user_profile.html.erb template is associated with the home_controller, not any devise controllers.

Now the problem is I want to put a form_for(@user) on the user_profile page and let users upload various photos with carrier wave, however I'm getting an undefined users_path error.

I've been messing around with this for hours and can't seem to figure it out.. I know it's probably a simple solution but at this point I have no idea, so any help would be greatly appreciated.

Thanks in advanced.

Ryan Bigg

Use current_user:

form_for(current_user)

This of course assumes you've defined the user_path route within config/routes.rb.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Access devise current_user variable in rails controller

From Dev

How do I add instance variables to Devise email templates?

From Dev

How to create new devise user using foreign controller

From Dev

How to create new devise user using foreign controller

From Dev

Rails 4: how to access the content of Devise Registrations Controller

From Dev

How to use devise parent_controller for devise inherited controller but skip for ActiveAdmin devise controller?

From Dev

create an instance after devise user registration, rails

From Dev

Devise + RSpec : How to authenticate a user?

From Dev

devise: update user on another controller without password

From Dev

devise: update user on another controller without password

From Dev

Devise: setup user default templates upon user confirmation

From Dev

When overriding the registration controller from devise, is it possible to access the newly created user on the create action?

From Dev

how to create users_controller.rb with devise?

From Dev

How to generate Registration controller of devise gem

From Dev

how to create users_controller.rb with devise?

From Dev

How to solve argument error in Devise Registrations controller?

From Dev

Nil instance variables in Rails view after subclassing Devise controller

From Dev

In Rails 4, how can I get data out of a devise user within a controller?

From Dev

How to programmatically sign in a user through Devise in Rails

From Dev

How to use "current_user" with devise in Rails?

From Dev

Devise: how to get user password from db

From Dev

How to assign roles to a user with devise, cancan and rolify?

From Dev

how to force another user to sign out with devise?

From Dev

How to use "current_user" with devise in Rails?

From Dev

How to associate a Devise User with another existing model?

From Dev

How to assign roles to a user with devise, cancan and rolify?

From Dev

How to delete an attribute from a Devise user in Rails?

From Dev

How to use devise to give privilege to different user?

From Dev

How do I access devise protected methods ?

Related Related

  1. 1

    Access devise current_user variable in rails controller

  2. 2

    How do I add instance variables to Devise email templates?

  3. 3

    How to create new devise user using foreign controller

  4. 4

    How to create new devise user using foreign controller

  5. 5

    Rails 4: how to access the content of Devise Registrations Controller

  6. 6

    How to use devise parent_controller for devise inherited controller but skip for ActiveAdmin devise controller?

  7. 7

    create an instance after devise user registration, rails

  8. 8

    Devise + RSpec : How to authenticate a user?

  9. 9

    devise: update user on another controller without password

  10. 10

    devise: update user on another controller without password

  11. 11

    Devise: setup user default templates upon user confirmation

  12. 12

    When overriding the registration controller from devise, is it possible to access the newly created user on the create action?

  13. 13

    how to create users_controller.rb with devise?

  14. 14

    How to generate Registration controller of devise gem

  15. 15

    how to create users_controller.rb with devise?

  16. 16

    How to solve argument error in Devise Registrations controller?

  17. 17

    Nil instance variables in Rails view after subclassing Devise controller

  18. 18

    In Rails 4, how can I get data out of a devise user within a controller?

  19. 19

    How to programmatically sign in a user through Devise in Rails

  20. 20

    How to use "current_user" with devise in Rails?

  21. 21

    Devise: how to get user password from db

  22. 22

    How to assign roles to a user with devise, cancan and rolify?

  23. 23

    how to force another user to sign out with devise?

  24. 24

    How to use "current_user" with devise in Rails?

  25. 25

    How to associate a Devise User with another existing model?

  26. 26

    How to assign roles to a user with devise, cancan and rolify?

  27. 27

    How to delete an attribute from a Devise user in Rails?

  28. 28

    How to use devise to give privilege to different user?

  29. 29

    How do I access devise protected methods ?

HotTag

Archive