chiku

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 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

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 »