Ok I think there is another easy way. What I'm trying to do now is send the id of the user that is trying to upload a new photo to the form "new_photo". That form has the id of the user but when the "submit" is selected the id get lost.
The other way to get the user_id is with the "set_user", but I don't know exactly how it works. I'm reading a few blogs and when the user login to the web the application has to save the user_id. Then, any controller can has that id. Could you please explain to me this way?. Thank you & Best regards, Alfredo. El martes, 15 de abril de 2014 11:12:11 UTC+2, Alfredo Barrero escribió: > > 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. > > Below is the code that I'm using: > > *"users/show.html.erb" -->* <%= link_to 'Add Photo', :method => > Photo.add(@user) %> > > *"photo.rb" --> * > def self.add (name) > puts 'Adding photo' > print name.name > end > > Thi other thing that I'm trying is the next one. Could you tell me if it > is correct? > > *"users/show.html.erb" --> * <%= link_to 'Add Photo', new_photo_path, > :id => @user.id %> > > Thanks & Best regards > > Alfred > -- 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/ddd70b5b-b3b1-480e-a4bd-235b68a352a8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

