Created
June 21, 2013 12:22
-
-
Save onslauth/5830815 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :a do | |
resources :b do | |
resources :c | |
end | |
end | |
Controller c | |
before_action :set_parents | |
... | |
def set_parents | |
@parents = [] | |
@a = A.find( params[:a_id] ) | |
@parents << @a | |
@b = B.find( params[:b_id] ) | |
@parents << @b | |
end | |
c/views/new.html.erb | |
<%= link_to 'Back', url_for( @parents ) %> results in a link to /a/1/b/2/c | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment