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”)) …
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>
git ignore .env files not working
https://stackoverflow.com/questions/38983153/git-ignore-env-files-not-working
Remove/Delete All dcoker images containers
# List all containers (only IDs) docker ps -aq # Stop all running containersdocker stop $(docker ps -aq)# Remove all containersdocker rm $(docker ps -aq)# Remove all imagesdocker rmi $(docker images -q)
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>`); }
Give permission to folder/subfolder in ubuntu
sudo chmod -R 777 /var/www/html/wordpress
Install Ganache In Ubuntu
1. Download ganache from the official Site 2 . open terminal and type sudo chmod a+x ganache-2.5.4-linux-x86_64.AppImage 3. now double click the file to open ganche
restore mongodb dataabse
mongorestore -d db_name dump/hello/
Change Postgres Password
To change the the postgres user’s password follow this steps Login into the psql: $ sudo -u postgres psql Then in the psql console change the password and quit: postgres=# password postgresEnter new password: <new-password>postgres=# q