I'm at the point where I can make basic rails apps, and am looking for a better overview of how rails is working.
This is what I am visualising. Is this correct?
rails new ...
creates the framework file structure.For an overview of Rails and how it works, you might find my article What is Ruby on Rails? helpful.
Rails is a software library that extends the Ruby programming language. It is a package library (specifically, a RubyGem), that is installed using the operating system command-line interface. The gem contains several tools, including a generator (script) that creates a default Rails project (rails new ...
). The default Rails project provides a set of files that conform to a set of conventions so all Rails applications have the same architecture.
Rails is a framework for building websites. As such, Rails establishes conventions for easier collaboration and maintenance. These conventions are codified as the Rails API (the application programming interface, or directives that control the code). The Rails API is documented online and described in books, articles, and blog posts. Learning Rails means learning how to use the Rails conventions and its API.
Many files created in the project directory by rails new ...
inherit from parent classes that are hidden in the Rails gem, providing behavior that is defined in the Rails API. For example, when you create a model that inherits from ActiveRecord, you can use methods from the ActiveRecord API to access a database.
When you run a Rails application with an application server, the custom code you've added to your Rails project directory is combined with the code provided in the Rails gem to respond to browser requests.
Your simplified description isn't far off. There is no "rails script"; there are many generators (for creating a model, controller, project directory, etc.) that are used during development. The rails new ...
generator (script) sets up a project directory from the command line but doesn't modify the Rails library provided by the gem. When you install the Rails gem in your Ruby development environment, the Rails software library (the API) is available to any Rails project you create in your file system. Any Rails project you build uses the code provided by the Rails gem, both to create initial project files and provide the full behavior of the framework. I'm not sure we'd say that a new project "extends" the Rails gem (that implies adding functionality that would be used in many projects) but certainly a new project incorporates or "builds on" the Rails gem.