Alfredo Barrero wrote in post #1143117: > Good morning everyone, > > I have a question, if anyone can answer it would be great. I'm trying to > send the user.id from the "users/show.html.erb" to > "photos_controller.rb", > but I'm not sure how to do it. I can send the user information to the > Model > but I'm not sure is that is correct.
Speaking generally, users are authenticated (login form) and the id of the user is stored in the session so that each controller can access the user directly from the user's session. It is certainly possible to pass the user's id along from request to request, but that's not typical for most apps. For an example you can take a look at Devise authentication framework, which provides you a "current_user" method that is accessible from any controller: https://github.com/plataformatec/devise -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/34e3d4c2d58a440f1b19c71868d26f0c%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.

