Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get an image to show in a formtastic :radio, :collection?
    primarykey
    data
    text
    <p>I can't get an image to show in a Formtastic form with radio buttons. Here's my form. The :activity_id, :as => radio is the issue:</p> <pre><code>&lt;%= semantic_form_for @event do |f| %&gt; &lt;%= f.inputs do %&gt; &lt;%= f.input :date, :as =&gt; :string, :input_html =&gt; { :class =&gt; 'jquery-ui-date'} %&gt; &lt;%= f.input :date, :as =&gt; :hidden, :input_html =&gt; { :id =&gt; 'date-alt'} %&gt; &lt;%= f.input :activity_id, :as =&gt; :radio, :collection =&gt; Activity.all %&gt; &lt;% end %&gt; &lt;%= f.actions do %&gt; &lt;%= f.action :submit, :as =&gt; :button %&gt; &lt;%= f.action :cancel, :as =&gt; :link %&gt; &lt;% end %&gt; &lt;% end %&gt; </code></pre> <p>That works fine as far as showing the radio button, the activity name, and saving correctly on submit. But I need to show the image that goes with the activity because most of my users cannot read and must rely on images and TTS. I've got the images showing in my other views.</p> <p>I've tried dozens of combinations of things with :hint, and :wrapper_html, and image_tag and so on. So many variations I've become scrambled in the brain-pan.</p> <p>A sample attempt:</p> <pre><code>&lt;%= f.input :activity_id, :as =&gt; :radio, :collection =&gt; Activity.all, :hint =&gt; f.template.image_tag(f.object.image_url(:thumb)) %&gt; </code></pre> <p>This gives me an "undefined method `image_url'" error. Yet this :hint works fine elsewhere.</p> <p>I'll switch back to a standard html.erb view if that helps, but my problem there was a "stringify_keys" error I was unable to solve.</p> <p>There's gotta be a way. Please? Thanks much. . .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload