mjbellantoni / formtastic-bootstrap

Formtastic form builder to generate Twitter Bootstrap-friendly markup.
MIT License
444 stars 217 forks source link

Can't use FormBuilder.default_hint_class? #130

Open bunnymatic opened 9 years ago

bunnymatic commented 9 years ago

In our app we're putting in a ckeditor row like so (in slim templates):

= f.input :description, as: :ckeditor, hint: 'For best results...', input_html: { ckeditor: { toolbar: 'mini' } }

This fails when the CkEditorInput (a formtastic input from the ckeditor gem) calls for a hint:

def hint_html
  if hint?
    template.content_tag(
      :p, 
      Formtastic::Util.html_safe(hint_text), 
      class => builder.default_hint_class
    )
  end
end

After further digging, it seems that FormtasticBootstrap::FormBuilder raises (https://github.com/mjbellantoni/formtastic-bootstrap/blob/master/lib/formtastic-bootstrap/form_builder.rb#L22) ...

def self.default_hint_class
  # self.default_inline_hint_class
  raise
end

Is there a good reason for this raise? I got around the issue by monkey patching that method. But I'd rather not have to do that.

Also, seemingly strangely we have this line in the same form:

= f.input :price, as: :string, hint: 'in dollars without the $ sign.'

and it works just fine.

Thanks for any info.

Relevant Gems:

mjbellantoni commented 9 years ago

I'm afraid if there's a good reason for this, I do not remember what it is. It's most likely an oversight. Can you submit a patch?