The way this works is really simple. We're going to create a new gem
bundle gem sweetalert Once we have the sweetalert gem, we can open it up in our editor, and the only thing we need to edit in here is the lib/sweetalert.rb file. The rest of these, you can go into at your own time, but the one that we need to focus on, and the one line of code we actually need to write is a class in here called Engine, this is going to inherit from Rails::Engine, and this is more or less saying that when rails loads this gem, it's going to look for this Engine class, and if it's defined, it's going to treat this gem's directory structure a little bit differently. It's going to work sort of like your rails application, almost as if you had a rails app inside of a rails app. How that works is by copying these directories over, so we're going to take the
gem 'sweetalert', path: 'Users/gorails/code/sweetalert'
Transcript written by Miguel
Join 18,000+ developers who get early access to new screencasts, articles, guides, updates, and more.