trailblazer/cells

Can't get form_with to work from a cell in Rails 6

marnen opened this issue · 3 comments

I just tried to use Cells with a Rails 6 application, and failed when trying to generate a (non-model-based) form. Even though I included ActionView::Helpers::FormHelper into the cell, form_with (and form_tag) always failed with NoMethodError: undefined method `[]' for nil:NilClass. Any ideas as to how to get this to work?

@apotonick i did use cells-rails when I had the problem. I can file an issue there if it would be better.

I think I figured out the issue. I used new instead of the cell helper method to render the cell, so cells-rails didn't get a chance to set up the context properly. Once I used the cell helper, everything worked. Leaving this open only because it might be worth documenting this gotcha.