Add sweetalert in Ruby On Rails

Total Blog Views: 53

Blog Status: publish

Created By: swazahmad Created at: 08-15-2021

Tags: ruby on rails sweetalert attractive notification ruby on rails

How To configure Sweetalert For Rails Flash Messages

Add Below Line In Gemfile

gem 'sweetalert-rails'
Run below command
 
bundle install
Update below Line in application.js
 
//= require sweetalert
Update Below Line applications.css
 
*= require sweetalert

Then Update application.html.erb

<script type="text/javascript">
    <%  if notice.present?%>
    var message = "<%= notice %>";
    sweetAlert(message);
    <% end %>
    <%  if alert.present?%>
    var message = "<%= alert %>";
    sweetAlert(message);
    <% end %>
  </script>
 
If have some queries and suggestion Please Let us know in comments


swazahmad

Swaz is Practice Lead of ROR Developer. he's a Blogger, Mentor, and Rubyst. He has expertise in Javascript also . he's highly skilled in designing, developing and testing web applications. He enjoys being challenged and interesting with projects that need him to



Comments



  • yego | almost 4 years ago
    NICE INFORMATION
  • swazahmad | almost 4 years ago
    Awesome Information Thanks For Sharing
Buy traffic for your website

About Shadbox

we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.

Services

Downloads