gemgem-trbrb
gemgem-trbrb copied to clipboard
Getting uninitialized constant Comment::Representer (NameError) in master branch
@apotonick Some offtopic at the beginning. Thanks for this framework! I can't wait to use it in production at https://inlinemanual.com. Maybe tweak the Operation bit (I am now bit influenced by Hanami::Interactor), but all the concepts are really nice. I am even thinking about rewriting our serializers from AMS to Roar, but lets see how it goes :)
Now back to the business... :beer: I am just in the middle of the book in the cells chapter and I finally got the feeling, okay lets see how it works in reality and installed this demo app. Unfortunately I got the following error:
Exiting
/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:21:in `block in <class:Index>': uninitialized constant Comment::Representer (NameError)
Full stacktrace is here:
➜ gemgem-trbrb git:(master) rails s
=> Booting Thin
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
digging through thing
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/thing/contract"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/thing/representer"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/thing/callback"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/thing/cell"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/thing/policy"
digging through user
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/user/contract"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/user/representer"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/user/callback"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/user/cell"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/user/policy"
digging through comment
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/comment/contract"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/comment/representer"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/comment/callback"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/comment/cell"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/comment/policy"
digging through session
@@@@@---> /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/models/session
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/session/contract"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/session/representer"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/session/callback"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/session/cell"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/session/policy"
digging through api/v1/thing
@@@@@---> /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/models/api/v1/thing
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/contract"
loading extension... "/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer"
Exiting
/home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:21:in `block in <class:Index>': uninitialized constant Comment::Representer (NameError)
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:20:in `initialize'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:20:in `new'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:20:in `<class:Index>'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:17:in `<module:Representer>'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:3:in `<module:Thing>'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:2:in `<module:V1>'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/app/concepts/api/v1/thing/representer.rb:1:in `<top (required)>'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-rails-0.2.0/lib/trailblazer/rails/railtie.rb:6:in `block in autoload_operations'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-loader-0.0.1/lib/trailblazer/loader.rb:32:in `block (2 levels) in call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-loader-0.0.1/lib/trailblazer/loader.rb:29:in `each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-loader-0.0.1/lib/trailblazer/loader.rb:29:in `block in call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-loader-0.0.1/lib/trailblazer/loader.rb:15:in `each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-loader-0.0.1/lib/trailblazer/loader.rb:15:in `call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-rails-0.2.0/lib/trailblazer/rails/railtie.rb:6:in `autoload_operations'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/trailblazer-rails-0.2.0/lib/trailblazer/rails/railtie.rb:25:in `block (2 levels) in <class:Railtie>'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:446:in `instance_exec'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:446:in `block in make_lambda'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:192:in `call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:192:in `block in simple'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `block in call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/config/environment.rb:5:in `<top (required)>'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/config.ru:3:in `require'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/config.ru:3:in `block in <main>'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/config.ru:in `new'
from /home/wojtha/Code/ruby/trailblazer/gemgem-trbrb/config.ru:in `<main>'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/server.rb:61:in `app'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/server.rb:78:in `start'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/wojtha/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
Hey, thanks! What's the content of comment/representer.rb
?
The code from master branch is here: https://github.com/apotonick/gemgem-trbrb/blob/master/app/concepts/api/v1/thing/representer.rb#L21
I got same error in chapter-11 branches. Chapters 03-10 seems to be ok, tried almost all of them (to be explicit I test these: chapter-03, chapter-05, chapter-06, chapter-07, chapter-09, chapter-10.)
Branches master
, chapter-11
and chapter-11-plural-directories
gave me this error as well.
seems to be namespacing issue, when fully qualifying the representer the issue seems to be fixed :
diff --git a/app/concepts/api/v1/thing/representer.rb b/app/concepts/api/v1/thing/representer.rb index 27d2801..6c72090 100644 --- a/app/concepts/api/v1/thing/representer.rb +++ b/app/concepts/api/v1/thing/representer.rb @@ -18,7 +18,7 @@ module API::V1 feature Roar::JSON::HAL with_comments = Class.new(Create) do - collection :comments, decorator: Comment::Representer::Show, embedded: true + collection :comments, decorator: API::V1::Comment::Representer::Show, embedded: true end collection :to_a, as: :things, embedded: true, decorator: with_comments