Ruby on Rails
Friday, November 6, 2015
Hello all!
I am new to all of this and I am trying to accomplish a couple things, I am hoping that someone will be able to assist me…
First -
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
<div class="inner">
<p><%= link_to(person) do %>
<strong><%= person.fname %> <%= person.lname %></strong>
<% end %></p>
<p><%= person.title %></p>
<p><%= person.position.capitalize %></p>
</div>
Secondly, the current route resolves to address.com/people/{:id} and I would like to it resolve to address.com/{:user_name} and I am not sure how to get this to work. I have tried a few different options but I am not quite sure what I am doing here.
resources :people, only: [:index, :show] do
resources :pubs, except: [:create, :new, :edit, :destroy]
end
I have attempted to add —> get 'people/:id/user_name' => 'people#user_name', as: :user_name
but this has not worked.
Thanks for any help!
Jason
-- I am new to all of this and I am trying to accomplish a couple things, I am hoping that someone will be able to assist me…
First -
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
<div class="inner">
<p><%= link_to(person) do %>
<strong><%= person.fname %> <%= person.lname %></strong>
<% end %></p>
<p><%= person.title %></p>
<p><%= person.position.capitalize %></p>
</div>
Secondly, the current route resolves to address.com/people/{:id} and I would like to it resolve to address.com/{:user_name} and I am not sure how to get this to work. I have tried a few different options but I am not quite sure what I am doing here.
resources :people, only: [:index, :show] do
resources :pubs, except: [:create, :new, :edit, :destroy]
end
I have attempted to add —> get 'people/:id/user_name' => 'people#user_name', as: :user_name
but this has not worked.
Thanks for any help!
Jason
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+unsubscribe@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/9fe9baeb-6e78-46d2-bdde-4c04207d0c6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment