Uncategorized

How to add file in rails?

Undefined method `attachment_path or URL for # Solved:- Use this code in output file. <%if orders.avatar.attached?%> <%= image_tag main_app.url_for(orders.avatar) %> <%end%> if you want to save the image URL in the database you can add this to your controller or model. :- main_app.url_for(model.”has_one_attached attribute name” ex:-avtar) Edit image size:- variant(resize: “200×400”) <%= image_tag main_app.url_for(orders.avatar.variant(resize: “200×400”)) …

How to add file in rails? Read More »

set counter i n react

  <button className=“btn btn-success” onClick={() => setCount(1)}>Reset</button> const [count, setCount] = useState(1); <button className=“btn btn-primary” onClick={() => setCount(prevCount => prevCount – 1)}>–</button> <input className=“” type=“text” value={count}></input> <button className=“btn btn-primary” onClick={() => setCount(prevCount => prevCount + 1)}>+</button>

change state value in woocommerce

//hide default state drop down for billing field jQuery(“#billing_state_field”).find(“span.select2-container”).hide(); //if billing state id found then replace a custom field if (jQuery(‘#billing_state’).length) { jQuery(“#billing_state”).replaceWith(`<input type=”text” class=”input-text ” name=”billing_state” id=”billing_state” placeholder=”” value=”${addressComponent.state_long}” autocomplete=”address-level2″ style=”border: none;”></input>`); }