I didn't really get the scenario there. If you don't mind in explain better
the flow you want to achieve...


*"users/show.html.erb"   --> *  <%= link_to 'Add Photo', new_photo_path,
> :id => @user.id %>


And about what you've been trying, I can say that it depends on how your
routes look like. Is there any association between Users and Photos? If so,
are the routes nested?

Have a look on section *2.7 Nested Resources* of this link* The guide is
your mate <http://guides.rubyonrails.org/routing.html>*






On Tue, Apr 15, 2014 at 7:12 PM, 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/CAOEz2q8vKVWP6WXb1f_s6RH5L5w%3DdAhmSCuoTGhs6pG2XQGhhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to