TrestleAdmin / trestle

A modern, responsive admin framework for Ruby on Rails
https://trestle.io
GNU Lesser General Public License v3.0
1.96k stars 177 forks source link

Undefined local variable or method `view_renderer' #107

Open Math3v opened 6 years ago

Math3v commented 6 years ago

Trestle version: 0.8.7 Rails version: 5.2.0

How to reproduce:

...
form do |user|
  render 'user_select'
end
...

Error: Undefined local variable or method `view_renderer' for #<Trestle::Form::Builder:0x00007fc2f6b58388>

How to fix:

module Trestle
  class Form
    class Renderer
      include ::ActionView::Helpers::RenderingHelper
    end
  end
end
...
form do |user|
  well do
    render 'user_select'
  end
end
...
spohlenz commented 6 years ago

Are you able to post the full stack trace? I'm not seeing the results that you are with the same versions of Trestle and Rails.

Math3v commented 6 years ago

@spohlenz

/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/lib/trestle/form/builder.rb:34:in `method_missing'
actionview (5.2.0) lib/action_view/helpers/rendering_helper.rb:37:in `render'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/lib/trestle/form/renderer.rb:46:in `method_missing'
app/admin/users_admin.rb:87:in `block (2 levels) in <top (required)>'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/lib/trestle/form/renderer.rb:26:in `instance_exec'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/lib/trestle/form/renderer.rb:26:in `block in render_form'
actionview (5.2.0) lib/action_view/helpers/capture_helper.rb:41:in `block in capture'
actionview (5.2.0) lib/action_view/helpers/capture_helper.rb:205:in `with_output_buffer'
actionview (5.2.0) lib/action_view/helpers/capture_helper.rb:41:in `capture'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/lib/trestle/form/renderer.rb:26:in `render_form'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/lib/trestle/form.rb:22:in `render'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/views/trestle/resource/_form.html.erb:2:in `___sers_matej__rvm_gems_ruby_______bundler_gems_trestle_e____dc___d__app_views_trestle_resource__form_html_erb___1997035149734419682_70237669213600'
actionview (5.2.0) lib/action_view/template.rb:159:in `block in render'
activesupport (5.2.0) lib/active_support/notifications.rb:170:in `instrument'
actionview (5.2.0) lib/action_view/template.rb:354:in `instrument_render_template'
actionview (5.2.0) lib/action_view/template.rb:157:in `render'
actionview (5.2.0) lib/action_view/renderer/partial_renderer.rb:344:in `block in render_partial'
actionview (5.2.0) lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
activesupport (5.2.0) lib/active_support/notifications.rb:168:in `block in instrument'
activesupport (5.2.0) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
activesupport (5.2.0) lib/active_support/notifications.rb:168:in `instrument'
actionview (5.2.0) lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
actionview (5.2.0) lib/action_view/renderer/partial_renderer.rb:333:in `render_partial'
actionview (5.2.0) lib/action_view/renderer/partial_renderer.rb:312:in `render'
actionview (5.2.0) lib/action_view/renderer/renderer.rb:49:in `render_partial'
actionview (5.2.0) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.2.0) lib/action_view/helpers/rendering_helper.rb:34:in `render'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/views/trestle/resource/new.html.erb:11:in `block in ___sers_matej__rvm_gems_ruby_______bundler_gems_trestle_e____dc___d__app_views_trestle_resource_new_html_erb__1781381716471929753_70237670330980'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/helpers/trestle/form_helper.rb:11:in `block (2 levels) in trestle_form_for'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/helpers/trestle/form_helper.rb:17:in `with_form'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/helpers/trestle/form_helper.rb:11:in `block in trestle_form_for'
actionview (5.2.0) lib/action_view/helpers/capture_helper.rb:41:in `block in capture'
actionview (5.2.0) lib/action_view/helpers/capture_helper.rb:205:in `with_output_buffer'
actionview (5.2.0) lib/action_view/helpers/capture_helper.rb:41:in `capture'
actionview (5.2.0) lib/action_view/helpers/form_helper.rb:452:in `form_for'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/helpers/trestle/form_helper.rb:10:in `trestle_form_for'
/Users/foo/.rvm/gems/ruby-2.5.0/bundler/gems/trestle-e3203dc904d1/app/views/trestle/resource/new.html.erb:10:in `___sers_foo__rvm_gems_ruby_______bundler_gems_trestle_e____dc___d__app_views_trestle_resource_new_html_erb__1781381716471929753_70237670330980'
actionview (5.2.0) lib/action_view/template.rb:159:in `block in render'
activesupport (5.2.0) lib/active_support/notifications.rb:170:in `instrument'