you probably figured this out already, but you should be able to do this with:
= render partial: "trees/tree", collection: island.trees
Question
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 using Rails convention shown in the islands/show.html.haml example?
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 Others::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 lostees/trees/tree
app/views/others/islands/show.html.haml
%h2 The Island
%div Trees
= render island.trees
#=> Missing partial others/trees/tree
Solution
you probably figured this out already, but you should be able to do this with:
= render partial: "trees/tree", collection: island.trees