adds the aasm gem for ruby state machines and optionally runs the rails generator
Used 20 times
J
Julian Rubisch
Usage
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/X6ksKO"
Template Source
Review the code before running this template on your machine.
def do_bundle
# Custom bundle command ensures dependencies are correctly installed
Bundler.with_unbundled_env { run "bundle install" }
end
gem 'aasm'
do_bundle
if yes?("Do you want to run the rails generator to add aasm to a model? (yes/no)")
model_name = ask("Which model do you want to add aasm to?")
generate(:aasm, model_name)
end