[Rails] Re: Dynamic Links within a namespace

2015-11-12 Thread Jason Or
This worked perfectly! Thank you!!!

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d939269fc92a4543fb3ecb14f44e3b1f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Dynamic Links within a namespace

2015-11-11 Thread Hoang Tran
you fail at
<%= link_to(person) do %>

You can follow me same as:

  <%= link_to admin_person_path(person) do %>
 <%= person.fname %> <%= person.lname %>
  <% end %>


-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ba58cffb4744c13324a1f9c6113c9911%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Dynamic Links within a namespace

2015-11-09 Thread Matt Jones


On Monday, 9 November 2015 09:27:52 UTC-5, Ruby-Forum.com User wrote:
>
> Hello all! 
>
> I am new to all of this and I am trying to accomplish something, and I 
> am hoping that someone will be able to assist me… 
>
>
> I am trying to set up a namespace within a dynamic link. I have created 
> an admin namespace and I need to following link to go to 
> ../admin/people/xxx 
>
>  
>   <%= link_to(person) do %> 
>  <%= person.fname %> <%= person.lname %> 
>   <% end %> 
>  
>
> Am I missing something from the controller or what? How do I get this 
> dynamic link to go to the namespace route and not the base page? Does 
> something go in the <%= link_to(person) do %> and if so what? I am just 
> so new to all of this, I am not sure how to solve this problem. 
>

This isn't mentioned in the `link_to` documentation, but looking at the 
source it appears you can pass the same sort of thing you'd give 
`polymorphic_path` to get namespace routes.

http://api.rubyonrails.org/classes/ActionDispatch/Routing/PolymorphicRoutes.html

So something like `link_to([:admin, person]) do` in your example should do 
the trick.

--Matt Jones

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a5bd6b0b-22fa-475c-877b-a1dae26c253b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Dynamic Links within a namespace

2015-11-09 Thread dasibre
Why not just use named routes. if you've namespaced your admin routes, you 
should have various routes available to you
http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing


On Monday, November 9, 2015 at 9:27:52 AM UTC-5, Ruby-Forum.com User wrote:
>
> Hello all! 
>
> I am new to all of this and I am trying to accomplish something, and I 
> am hoping that someone will be able to assist me… 
>
>
> I am trying to set up a namespace within a dynamic link. I have created 
> an admin namespace and I need to following link to go to 
> ../admin/people/xxx 
>
>  
>   <%= link_to(person) do %> 
>  <%= person.fname %> <%= person.lname %> 
>   <% end %> 
>  
>
> Am I missing something from the controller or what? How do I get this 
> dynamic link to go to the namespace route and not the base page? Does 
> something go in the <%= link_to(person) do %> and if so what? I am just 
> so new to all of this, I am not sure how to solve this problem. 
>
>
> Thanks for any help! 
>
> Jason 
>
> -- 
> 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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/7ae0c94a-7ec0-43ad-9d92-e66bfffe35a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.