Hiccdown Development Notes

Showing only #316 and its comments.

See full discussion
  Log in or sign up to participate in this discussion.
With an account, you can revise, criticize, and comment on ideas.

Discussions can branch out indefinitely. Zoom out for the bird’s-eye view.
Dennis Hackethal’s avatar
2nd of 5 versions

Hiccdown methods should live in their own, separate modules. How about they are called ‘renderers’?

ruby
module ProductsRenderer
def self.index vc, # …
vc.some_helper_method
end
end

A benefit of this approach is that, when people start a new Rails app, they may end up putting whatever they’d otherwise put in a helper in a renderer, since renderers have the benefit of having unambiguously resolvable method names.

Criticized1Archived
Dennis Hackethal’s avatar
2nd of 2 versions

Then how would you call index from a helper method?

Criticism of #316Criticized1
Dennis Hackethal’s avatar

I don’t think that’s something people would do a lot, but they still easily could: ProductsRenderer.index(self)

Criticism of #317
Dennis Hackethal’s avatar

Test this!

Criticism of #315Criticized1
Dennis Hackethal’s avatar
2nd of 2 versions

Tested, it works. self does indeed point to the view_context in the helper. Verified by printing object_ids.

Criticism of #321
Dennis Hackethal’s avatar

Not as of #330, they couldn’t.

Criticism of #315Criticized1
Dennis Hackethal’s avatar

It doesn’t really matter. This would be like calling a controller action from a helper method. Not something people do.

Criticism of #331
Dennis Hackethal’s avatar

I don’t like the term ‘renderer’ yet. It’s too loaded with meaning, what with Rails already having a render method in controllers and another render method in views…

Criticism of #316
Dennis Hackethal’s avatar

Maybe ‘Display’. ProductsDisplay