Hiccdown Development Notes

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.

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

module ProductsDisplay
  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 display, since displays have the benefit of having unambiguously resolvable method names.

#325 · · Dennis HackethalOP revised 9 months ago · context · 3rd of 4 versions · Criticized2 criticim(s)

Then how would you call index from a helper method?

#317 · · Dennis HackethalOP revised 10 months ago · 2nd of 2 versions · Criticism of #325Criticized1 criticim(s)

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

#315 · · Dennis HackethalOP, 10 months ago · Criticism of #317

Test this!

#321 · · Dennis HackethalOP, 9 months ago · Criticism of #315Criticized1 criticim(s)

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

#323 · · Dennis HackethalOP revised 9 months ago · 2nd of 2 versions · Criticism of #321
#323 · expand
#321 · expand

Not as of #330, they couldn’t.

#331 · · Dennis HackethalOP, 9 months ago · Criticism of #315Criticized1 criticim(s)

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

#341 · · Dennis HackethalOP, 9 months ago · Criticism of #331
#341 · expand
#331 · expand
#315 · expand
#317 · expand

I’m trying this now. Having to prepend every invocation of a helper method with vc. is getting really old really fast.

#326 · · Dennis HackethalOP, 9 months ago · Criticism of #325
#326 · expand

Instance variables are not available inside the methods.

#327 · · Dennis HackethalOP, 9 months ago · Criticism of #325

They are: vc.instance_variable_get(:@foo)

#328 · · Dennis HackethalOP, 9 months ago · Criticism of #327Criticized1 criticim(s)

That’s way too verbose.

#329 · · Dennis HackethalOP, 9 months ago · Criticism of #328
#329 · expand
#328 · expand
#327 · expand
#325 · expand