You do it like this: <%= link_to "Pic", your_route(user_Id: user.id) >
Then in your controller you can access the user id with: params[:user_id] Hope it helps On Apr 15, 2014 2:12 AM, "Alfredo Barrero" <[email protected]> wrote: > 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/b6ffe45d-de31-47d2-8609-f3c08eaa15ad%40googlegroups.com<https://groups.google.com/d/msgid/rubyonrails-talk/b6ffe45d-de31-47d2-8609-f3c08eaa15ad%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAHRDpXroxJj8c8DS4tyTq9a6rVfae3zQn_E_Lu27-Ny%2B0XWPbA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

