Rails action Mailer
Notifier.welcome(User.first).deliver_later! # Notifier.welcome(User.first).deliver_later!(wait: 1.hour) # Notifier.welcome(User.first).deliver_later!(wait_until: 10.hours.from_now) # Notifier.welcome(User.first).deliver_later!(priority: 10) #
Ruby if array include?how to check a array with a value if present.
Step -1 https://stackoverflow.com/questions/1986386/how-to-check-if-a-value-exists-in-an-array-in-ruby#:~:text=This%20is%20another%20way%20to,the%20element%20in%20the%20array.&text=This%20returns%20the%20index%20of,contains%20the%20letter%20’o’.&text=index%20still%20iterates%20over%20the,the%20value%20of%20the%20element.
Ruby find inside a hash or array
@selected_rate=@rates(“rates is a array object”).select {|rates| rates[“object_id”] == @shippo_order.rate_id } new thing is every variable or object instance we make in ruby have there won object_id,that can be aaccess by @instance or variable .object_id we can get the selected rates like :-<%=@selected_rate[0][“object_id”]%> my @rates object
rails csv to json
csv file inside email;Identifier;password;Recovery code;Fname;Lname;Department;[email protected];9012;12se74;rb9012;Rachel;Booker;Sales;[email protected];2070;04ap67;lg2070;Laura;Grey;Depot;[email protected];4081;30no86;cj4081;Craig;Johnson;Depot;[email protected];9346;14ju73;mj9346;Mary;Jenkins;Engineering;[email protected];5079;09ja61;js5079;Jamie;Smith;Engineering;Manchester
rails route multiname OrderShipping
the rails route should be added like Order_Shipping.and the class should be like class OrderShippingController < BaseController
rails sh: 1: /usr/sbin/sendmail: not found in docker
you will get it soon
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”)) …