Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::MissingTemplate with namespaced controller in Rails 6 #61

Open
otagi opened this issue Jul 13, 2020 · 0 comments · May be fixed by #62
Open

ActionView::MissingTemplate with namespaced controller in Rails 6 #61

otagi opened this issue Jul 13, 2020 · 0 comments · May be fixed by #62

Comments

@otagi
Copy link

otagi commented Jul 13, 2020

When a controller with a namespace is used to show a Sir Trevor attribute, Rails will prepend the block partial path with that namespace, causing an ActionView::MissingTemplate exception.

It looks like SirTrevorRails::ViewResolver#find_templates should correct the path, but that method is never called by Rails 6.0.3.2.

Example:

# app/models/blog/post.rb
class Blog::Post < ApplicationRecord
  sir_trevor_content :content
end

# app/controllers/blog/posts_controller.rb
class Blog::PostsController < ApplicationController
  def show
    @blog_post = Blog::Post.find(params[:id])
  end
end

# app/views/blog/posts/show.html.erb
<%= render @blog_post.content %>

Error:

ActionView::MissingTemplate in Blog::Posts#show

Showing [root]/app/views/blog/posts/show.html.erb where line #1 raised:

Missing partial blog/sir_trevor/blocks/_text_block with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
  * "[root]/app/views"
  * …
@otagi otagi linked a pull request Jul 14, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant