Home>

In the flea market app creation,: image is also described in active storage installed, association, private method

class ItemsController</pre>
<pre><code data-language = "Ruby">class Item</pre>
<pre><code data-language = "Ruby"><header><% = link_to image_tag ('furima-logo-color.png', size: '185x50'), "/"%></header>     Enter product information   <% = form_with model: @item, local: true do | f |%>  Let's pass a<% # instance so that a message is displayed when an error occurs. %><% = render'shared/error_messages', model: f.object%><% # // Let's pass an instance so that a message will be displayed when an error occurs. %><% #Exhibited image%>                Exhibition image
      <span>Required</span>                <p>        Click to upload file
      </p>    <% = f.file_field: image, id: "item-image"%>    <% = image_tag item.image.variant (resize: '500x500'), class:'item-image' if @ item.image.attached?%>          <% #/Exhibition image%><% # Product name and product description%>        Product name
      <span>Required</span>        <% = f.text_area: name, class: "items-text", id: "item-name", placeholder: "Product name (up to 40 characters required)", maxlength: "40"%>                      Product description
        <span>Required</span>            <% = f.text_area: description, class: "items-text", id: "item-info", placeholder: "Product description (required up to 1,000 characters) (color, material, weight, list price, notes, etc. ) Example) This jacket was purchased for 10,000 yen around 2010. It is light gray and has no scratches. It is recommended because it is easy to match. ", Rows:" 7 ", maxlength:" 1000 "%>          <% #/Product name and product description%><% # Product Details%>         Product details                         Category
        <span>Required</span>            <% = f.collection_select (: category_id, Category.all,: id,: name, {},

 {class: "select-box", id: "item-category"})%>                Product condition
        <span>Required</span>            <% = f.collection_select (: condition_id, Condition.all,: id,: name, {},

 {class: "select-box", id: "item-sales-status"})%>          <% #/Product Details%><% # About delivery%>              <span>About delivery</span>      ?                               Shipping charges
        <span>Required</span>            <% = f.collection_select (: postage_id, Postage.all,: id,: name, {},

 {class: "select-box", id: "item-shipping-fee-status"})%>                Shipping area
        <span>Required</span>            <% = f.collection_select (: region_id, Region.all,: id,: name, {},

 {class: "select-box", id: "item-prefecture"})%>                Days to ship
        <span>Required</span>            <% = f.collection_select (: shipping_date_id, ShippingDate.all,: id,: data, {},

 {class: "select-box", id: "item-scheduled-delivery"})%>          <% #/About delivery%><% # Selling price%>      <span>Selling price<br>(¥ 300-9,999,999)</span>      ?                                         <span>price</span>        <span>Required</span>                <span>\</span>      <% = f.text_field: price, class: "price-input", id: "item-price", placeholder: "Example) 300"%>                      <span>Sales commission (10%)</span>      <span>        <span></span>Yen
        </span>                      <span>Sales profit</span>      <span>        <span></span>Yen
              </span>          <% #/Selling price%><% # Note%>      <p>       Forbidden listings,          Act         Please be sure to check.
    </p>  <p>      If i have a branded product with a serial number, please enter it.
         Sale of fake brands         Is a crime and can be punished.
    </p>  <p>      Also, I have an exhibition
         Merchant Terms         You agree with.
    </p>    <% #/Precautionary statement%><% # Bottom button%>      <% = f.submit "Sell", class: "sell-btn"%>  <% = link_to'return', root_path, class: "back-btn"%>    <% #/Bottom button%><% end%><footer><ul>  <li>Privacy Policy</li>  <li>Flea Market Terms of Service</li>  <li>Notation related to specific commercial transactions</li></ul><% = link_to image_tag ('furima-logo-color.png', size: '185x50'), "/"%><p>    © ︎Furima, Inc.
  </p></footer>


Thanks for your professor.

  • Answer # 1

    validates: image []
    It looks like a full-width space here, is that okay?
    The error also seems to make such an indication.