0
votes
view = ActionView::Base.new(ActionController::Base.view_paths, {}, ActionController::Base.new)

# works fine
puts view.render(file: 'books/index')

# doesn't work
puts view.render('books/index', layout: 'application')                                                                                                      

ActionView::MissingTemplate: Missing partial books/_index with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:

And it doesn't work when there is user_signed_in? in view (view.render(file: 'books/index')).

ActionView::Template::Error: undefined method `user_signed_in?' for #

2

2 Answers

0
votes

I think you need to create _index.html.erb (partial file) in app/view/books folder.

0
votes

You have not added a partial, _index.html.erb in your app/views/books