Forum: Ruby on Rails formtastic: radio button collection image_tag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
693f7cc2d5208871b52b90e70b7854bd?d=identicon&s=25 alexander ryder (Guest)
on 2014-06-16 09:15
(Received via mailing list)
Hello,

I would like to ask, how am I going to integrate an image tag during
edit
on formtastic for a collection of array of images?

  form do |f|
    f.inputs "Building" do
      f.input :name
      *f.input :image,  :as => :radio , :collection =>
Dir.glob("public/img/buildings/*")*
    end
    f.actions
  end

Thank you in advance,

Alex
693f7cc2d5208871b52b90e70b7854bd?d=identicon&s=25 Alex Ryder (Guest)
on 2014-06-16 10:51
(Received via mailing list)
images = Hash.new
  Dir.glob("public/img/buildings/*").each do |s|
    s.gsub!("public/img/buildings/", "")
    images["<img src='/img/buildings/".html_safe + s + "'>".html_safe] =
s
  end

 form do |f|
    f.inputs "Building" do
      f.input :name
      *f.input :image,  :as => :radio , :collection => images*
    end
    f.actions
  end
This topic is locked and can not be replied to.