Generators can create invalid migrations when passing an invalid field type. For example, when mixing up the name and type: bin/rails g model post string:title This will generate a field for post with a column named `string` of the type `title`, instead of a column named `title` of the type `string`. Running the migration will result in an error as the type `title` is not known to the database. Instead of generating invalid files, the generator should raise an error if the type is invalid. We validate the type by checking if it's a default migration types like: string, integer, datetime, but also references, and rich_text. If the type isn't a default type, we can ask the database connection if the type is valid. This uses the `valid_type?` method defined on each database adapter, which returns true if the adapter supports the column type. This method is also used by the SchemaDumper. Some gems like 'postgis' add custom types. The 'postgis' gem adds these types by overriding the `native_database_types` method. That method is used by `valid_type?` method on the database adapter, making this change compatible with 'postgis'.
2.3 KiB
-
Raise an error in generators if a field type is invalid.
Petrik de Heus
-
bin/rails tmp:clear
deletes also files and directories intmp/storage
.George Claghorn
-
Fix compatibility with
psych >= 4
.Starting in Psych 4.0.0
YAML.load
behaves likeYAML.safe_load
. To preserve compatibilityRails.application.config_for
now usesYAML.unsafe_load
if available.Jean Boussier
-
Allow loading nested locales in engines.
Gannon McGibbon
-
Ensure
Rails.application.config_for
always cast hashes toActiveSupport::OrderedOptions
.Jean Boussier
-
Remove Rack::Runtime from the default middleware stack and deprecate referencing it in middleware operations without adding it back
Hartley McGuire
-
Allow adding additional authorized hosts in development via
ENV['RAILS_DEVELOPMENT_HOSTS']
Josh Abernathy, Debbie Milburn
-
Add app concern and test keepfiles to generated engine plugins.
Gannon McGibbon
-
Stop generating a license for in-app plugins.
Gannon McGibbon
-
rails app:update
no longer prompts you to overwrite files that are generally modified in the course of developing a Rails app. See #41083 for the full list of changes.Alex Ghiculescu
-
Change default branch for new Rails projects and plugins to
main
.Prateek Choudhary
-
Add benchmark method that can be called from anywhere.
This method is used as a quick way to measure & log the speed of some code. However, it was previously available only in specific contexts, mainly views and controllers. The new Rails.benchmark can be used in the rest of your app: services, API wrappers, models, etc.
def test Rails.benchmark("test") { ... } end
Simon Perepelitsa
-
Removed manifest.js and application.css in app/assets folder when --skip-sprockets option passed as flag to rails.
Cindy Gao
-
Add support for stylesheets and ERB views to
rails stats
.Joel Hawksley
-
Allow appended root routes to take precedence over internal welcome controller.
Gannon McGibbon
Please check 6-1-stable for previous changes.