0

I have the following form but for some reason, I can't get the HTML class to come appear in the resulting code. The documentation suggests this should work, but they don't have an example that uses a block. I've tried a few different things but I haven't found the right answer yet. I have to use a block to get the custom data to appear with the select.

= simple_form_for([:admin, @theme]) do |f|
  = f.input :title_bar
  = f.input :apple_touch_icon_image, input_html: { class: 'imagepicker' } do
    = f.select :apple_touch_icon_image_id, Theme::AppleTouchIconImage.where(company: @company).map{ |i| [i.id, i.id, { 'data-img-src' => i.image.url(:thumbnail) }] }

= f.button :submit, class: "btn-success"
2
  • I assume you can't do it because you're using the rails helper. What happens if you try removing the class from the input and adding it to the rails helper = f.select :apple_touch_icon_image_id, Theme::AppleTouchIconImage.where(company: @company).map{ |i| [i.id, i.id, { 'data-img-src' => i.image.url(:thumbnail) }] }, class: 'imagepicker' Commented Jul 30, 2015 at 13:52
  • No, it still doesn't show up. Commented Jul 30, 2015 at 13:56

1 Answer 1

2

I would try:

= f.input :apple_touch_icon_image do
  = f.select :apple_touch_icon_image_id, Theme::AppleTouchIconImage.where(company: @company).map{ |i| [i.id, i.id, { 'data-img-src' => i.image.url(:thumbnail) }] }, {}, { class: 'imagepicker' }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.