i have the following code in my rails 6 app . using active storage for saving images to the database
<%= form_for(@business, url: supplier_save_business_categories_path, :html => {method: :post } ) do |f| %>
<%= f.collection_check_boxes(:category_ids, Category.all, :id, :name) do |b| %>
<%= b.label class: "check_box" do%>
<%#= image_tag(url_for(b.image)) if b.image.present? %> image is not getting displayed here.
<%=b.check_box style: "display: none;"%> <%= b.text %>
< %end%>
<% end %>
trying to display category image like this.
<%#= image_tag(url_for(b.image)) if b.image.present? %>
but the image is not getting displayed here. when category name is getting displayed from db from category record, i do not know why the category image is not getiing displayed.
getting the following error.
undefined method `image' for #<ActionView::Helpers::Tags::CollectionCheckBoxes::CheckBoxBuilder:0x00007fb6205a48c0>
Aucun commentaire:
Enregistrer un commentaire