These models are actually for a pull request (PR) submitted for the guide so that just one set of models is used for all examples. If the PR is accepted, then these will match up with what the guide says.
Clone this repo to get a very simple Rails app with data that you can use to run the examples in the guide. Use this draft version of the guide; it's the one with my proposed changed (based on the PR). Detailed installation instructions are in the Installation and Use section below.
I created this to help people run and understand the examples in the Rails Guide. I want to save people -- especially novices who are coming up many learning curves at once -- the time and effort needed to figure out exactly how to define and scaffold the models used in the examples.
The goal is to present the models with just enough data so the examples can be run and explored.
This is a first draft. The data does not yet match the example results in the guide exactly.
This is not a complete or efficient Rails application.
The models are defined like they are as examples to illustrate code and concepts from the guide. They would not necessarily use the same definitions and methods in a real world Rails application. Only very minimal layout (view) work was done.
Read more about the details and intention on the home page when you run this as a Rails app. (This is a Rails .html.erb
file. It will fully readable when you run this as a Rails application.)
-
Rails 5.2.2
This may run just fine under earlier 5.x versions of Rails. I have not tested it. I made this to work with the examples in the guide for Rails 5.2.2. -
Sqlite3
TheGemfile
andconfig/db
are set up to use this, but you can use whatever db you want. There's no code that is db specific. Feel free to change the Gemfile and use the db of your choice) -
Ruby 2.5.1
Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. -
Bootstrap 4.x
Bootstrap is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with our Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful plugins built on jQuery. -
FontAwesome Sass
A Sass-powered version of FontAwesome for your Ruby projects and plays nicely with Ruby on Rails, Compass, Sprockets, etc. -
Smarter CSV
SmarterCSV is a Ruby Gem for smarter importing of CSV Files as Array(s) of Hashes, suitable for parallel processing with Resque or Sidekiq, as well as direct processing with ActiveRecord, Mongoiid.
-
Clone or fork this repo
-
Ensure your database is configured: check
config/database.yml
to ensure the settings are right for your system.
(This uses SqlLite3. If you want to use a different database, be sure to update the gem in theGemfile
and update the database settings.) Read more about setting up your database in the Getting Started Rails Guide -
bin/rails db:setup
creates the database, runs the migrations, and seeds it with the example data. -
Use the
rails console
to run the examples from the guide. -
Run it as a local web application with
rails server
to see the data in web page views.
Is this helpful? How could it be made more helpful? Please post comments and suggestions about the models and using them in the Github repo issues queue. If you have feedback about the guide, please post your comments in the Rails github repo.
The authors and contributors have agreed to license all other software under the MIT license, an open source free software license. See the file named LICENSE which includes a disclaimer of warranty.