trailblazer / cells

View components for Ruby and Rails.
https://trailblazer.to/2.1/docs/cells.html
3.07k stars 236 forks source link

select form_helper doesn't work in cells 4 #273

Closed samstickland closed 9 years ago

samstickland commented 9 years ago

actionview-4.2.0/lib/action_view/helpers/form_options_helper.rb defines the select helper like this:

def select(method, choices = nil, options = {}, html_options = {}, &block)
  @template.select(@object_name, method, choices, objectify_options(options), @default_options.merge(html_options), &block)
end

But when this gets called from inside a cell @template has been set to the Cell instance, and causes an error like this:

NoMethodError (private method `select' called for #WorkHistoryFormCell:0x00000007c96998):

The confusing thing is that I can't find a definition of this method in the source code. It doesn't seem to be in the source code and the debugger can't find the defination:

(byebug) WorkHistoryFormCell.instance_method(:select).source_location
nil

The form helpers text_area and text_field are working just fine.

samstickland commented 9 years ago

After a lot of digging around I found that I also needed to include the following:

include ActionView::Helpers::FormOptionsHelper
ciembor commented 7 years ago

@samstickland thank you for digging.