Skip to content

Instantly share code, notes, and snippets.

@awilkening
Last active August 29, 2015 13:58
Show Gist options
  • Save awilkening/9980677 to your computer and use it in GitHub Desktop.
Save awilkening/9980677 to your computer and use it in GitHub Desktop.
I would like to locate a partial in the app/views dir to be shared by two name spaces. How can I link the missing partials, (lostees or others)/trees/tree.html.haml to trees/tree.html.haml?
# config/routes.rb
namespace :lostees do
resources :islands
end
namespace :others do
resources :islands
end
# app/controllers/lostees/islands_controller.rb
class Lostees::IslandsController < Lostees::BaseController
end
# app/controllers/others/islands_controller.rb
class Lostees::IslandsController < Others::BaseController
end
# app/views/trees/_tree.html.haml
= content_tag_for tree do
= tree.name
# app/views/lostees/islands/show.html.haml
%h2 The Island
%div Trees
= render island.trees
#=> Missing partial lostess/trees/tree
# app/views/others/islands/show.html.haml
%h2 The Island
%div Trees
= render island.trees
#=> Missing partial others/trees/tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment