zendesk/curly

Main Application Layout With Presenter

barkerja opened this issue · 4 comments

What's the correct way of creating the main app layout and its presenter?

Currently I have:

class ApplicationPresenter < Curly::Presenter located in app/presenters/application_presenter.rb

But upon load, I keep seeing:

undefined method 'method_available?' for nil:NilClass which seems to spawn from unless presenter_class.method_available?(method.to_sym) in lib/curly/compiler.rb (it appears the presenter isn't being correctly passed into this method.

First of all, it seems like you have a slightly outdated version of Curly – the error message should be more instructive than that. Which version are you using?

Secondly, the path to the application layout is layouts/application, so the presenter will be called Layouts::ApplicationPresenter and should be placed in app/presenters/layouts/application_presenter.rb.

I'll write this up on the wiki.

0.9.1 it looks like.

After making the changes you suggested, I now see:
Expected /app/presenters/layouts/application_presenter.rb to define Layouts::ApplicationPresenter

Which it does. app/presenters/layouts/application_presenter.rb is declared as: class Layouts::ApplicationPresenter < Curly::Presenter

Actually, disregard that last post. Was a case of Sublime not working with the right file after I had moved it in finder. Sorry, and thanks!

Great, glad to know that it's working!

Please don't hesitate to write if you run into other issues.