Build a playground to experiment with Rails quickly and easily
Ever wanted to quickly try out a new gem or experiment with a Rails feature? That's what Rails Play is all about. It creates a Ruby on Rails playground app containing a few models, seed data, controllers and basic CRUD views. Everything you need to start playing packed in one simple command,
rplay -n. Check out RailsPlay.net.
The importance of experimenting
There's a thing I try to hammer as much as possible into the brain of people I coach: learn by experimenting features in isolation. This method is also recommended by Justin Weiss in his Practicing Rails book. In essence, it is the practice makes perfect mantra applied to coding with Rails.
When learning Rails, separate features into small, bite-sized blocks and try them out outside of the context of a larger project. That means building, building and more building test apps. Starting again and again with
rails new, using scaffolds to generate models, controllers and views, preparing your database and seeding some data can become tedious and distracts you from your learning. This is why I made Rails Play.
What can Rails Play do for you?
Rails Play simply builds a Rails app with few models, associations, controllers and CRUD views much like
rails generate scaffold would do. On top of that, it runs
bundle install, it migrates your database and seeds it with some initial data. That's it. It's not much but it removes the friction of creating yet another test app just to experiment with a new gem or a Rails feature you want to try out.
Rails Play is not an app builder. You should not use it to start a new project. If that is what you are looking for, check out RailsBricks which is a full-featured Rails app builder.
Get Rails Play and start playing
In order to install Rails Play, you only need to have Ruby installed on your machine. Run
gem install railsplay from the command line and you are good to go.
Create a new Rails app with Rails Play
Create the app:
Run your Rails server:
cd railsplay rails server
Point your browser to http://localhost:3000.
Give your app another name
Simply specify the app name after the
rplay -n MyAppName
Note that Rails app naming conventions apply.
Skip bundle install and database setup
You can also opt for not having
rake db:migrate and
rake db:seed to be run automatically after your app gets created. This can be useful if you want to change Rails version or add other gems to your Gemfile:
rplay -n --skip-bundle
rplay -n MyAppName --skip-bundle
Want to contribute or make a suggestion?